while

This command allows to write loops.

while [EXPRESSION]

  • EXPRESSION – A conditionnale expression.

Its syntax is similar to “if” command.

The command takes a single argument, which is an expression to evaluate and must be followed by the commands to execute, one per line, terminated by “end”.

These commands are called the body of the loop. The commands in the body of “while” are executed repeatedly as long as the expression evaluates to true.