A while statement is used to loop over some statements several times, as long as a specified condition is true.
whilecondition
dostatement
whilecondition
/* 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.
whilecondition
statements
elsestatements
end
Yewslip>
factorial = 1Yewslip>
n = 5Yewslip>
while n > 1...>
factorial *= n...>
n -= 1...>
endYewslip>
print factorial120