|
Contents | Previous | Next | Subchapters |
| Syntax |
if expression list of statements expressionlist of statements expressionlist of statements |
| O-Matrix Mode | if |
if token begins a
block
without needing the begin keyword.
If any element of the expression following the if is
zero, the expression is considered false.
In addition, the keyword elseif
can be used to terminate one block and begin another.
Note that when an if is input at the command line,
execution will not occur until the corresponding end
is entered.
x = 1;
if x <= 0
0
elseif x <= 1
1
else
2
end
O-Matrix will reply
1
If you enter
x = [ 1 0 ];
if x
1
else
2
end
O-Matrix will respond
2