while

while — iterates, evaluating a statement.

Syntax

while (condition) statement

		

Arguments

condition

Any Gamma or Lisp expression.

statement

Any Gamma or Lisp statement.

Returns

The value of condition at the final iteration.

Description

This function iterates until its condition evaluates to nil, evaluating the statement at each iteration. The condition is evaluated before the statement, so it is possible for a while loop to iterate zero times.

Example

Gamma> x = 0;
0
Gamma> while (x < 5) { princ (x, "\n"); x++; }
0
1
2
3
4
4
Gamma> x;
5
Gamma> 

See Also

for, if, Statements