Language reference
Control flow
Conditional branches, loops, selection, and script returns.
01
Conditions
Conditions accept booleans or finite scalar numbers. Zero is false; any other finite scalar is true.
value = 7;
if value < 0
disp("negative");
elseif value == 0
disp("zero");
else
disp("positive");
end02
for and while
Range loops evaluate bounds once. Matrix for loops iterate columns; a row vector therefore yields one scalar per iteration.
total = 0;
for value = 1:5
total = total + value;
end
while total > 10
total = total - 1;
end03
switch
Cases match scalar numbers, booleans, or strings without fall-through. String matching is case-sensitive.
switch mode
case "fast"
disp("Fast mode");
otherwise
disp("Default mode");
end04
Backend status
Support boundary
Loops, conditionals, switch, and return are interpreter-only at the audited commit.