while
Executes a block of PSL code while the evaluation of a statement is TRUE.
Syntax
while ( expression ) { BLOCK }
Parameters
Parameter | Definition |
---|---|
expression | PSL statement whose evaluation returns either TRUE or FALSE |
BLOCK | one or more PSL statements that execute repeatedly as long as expression evaluates to TRUE |
Description
The while
loop executes statements as long as expression evaluates to TRUE (non-zero).
Example
The following sample PSL statements print the integers from 1 to 10:
x = 1;
while (x <= 10){
print (x, " ");
x++;
}
print ("\n");
Where to go from here
Was this page helpful? Yes No
Submitting...
Thank you
Comments
Log in or register to comment.