Operators > Programming Operators > The While Loop Operator
The While Loop Operator
Operator
Description
Evaluates y while x is nonzero (true). The condition expression is evaluated at the beginning of the while loop, so the loop may never execute. The loop stops iterating as soon as the condition is false and it returns the last value calculated in its body on the previous iteration.
Operands
x is any valid expression or sequence of expressions that can evaluate to 0, frequently a Boolean expression.
y is any valid expression or sequence of expressions. At least one expression in the loop body must change the condition expression, x, so that it becomes false. Otherwise, the loop executes indefinitely.
Watch this video to learn more about the while loop operator:
Additional Information
You can type the word while and then press Ctrl+J to convert the word to a programming operator with all its placeholders.
Was this helpful?