While statement

A while statement is used to loop over some statements several times, as long as a specified condition is true.

while condition do statement
while condition  /* optional "do" here */
    statements
end

A break statement exits the loop.

break

A continue statement stops the execution of the statement list and returns to the condition test.

continue

A while statement may also have an else clause. Statements in the else clause are executed when the loop ends because the condition was or became false. They are not executed after a break statement inside the loop.

while condition
    statements
else
    statements
end
Yewslip> factorial = 1

Yewslip> n = 5

Yewslip> while n > 1
    ...>     factorial *= n
    ...>     n -= 1
    ...> end

Yewslip> print factorial
120