|
Contents | Previous | Next | Subchapters |
| Syntax |
while expression statement list |
| O-Matrix Mode | while |
while token begins a
block
without needing the begin keyword.
If any element of the expression following the while is
zero, the expression is considered false.
Note that when a while is input at the command line,
execution will not occur until the corresponding end
is entered.
x = 0;
while x <= 0
x = x + 1;
x = x + 1;
end
x
O-Matrix will reply
2
Note that the block of statements is executed once,
and the block contains two additions.
If you enter
x = [ 3 2 ];
while x
x = x - 1;
end
x
O-Matrix will reply
[ 1 0 ]