FANDOM


The while keyword is a looping construct whose general form is:

while (expression) {
    instructions
}

Where expression is usually of the form: variable compare op value, and the loop continues to execute instructions until expression evaluates to false (i.e., 0). 'instructions' can be one or more incstruction, which can be something like setting a variable, doing calculations, calling a method, or another loop.

%val=5;

while( %val )
{
    echo( %val-- );
}

While

See also Edit