526 Programming
If you entered SQM1(8) in Home view, the result returned
would be 63.
RETURN Syntax: RETURN expression;
Returns the current value of expression.
KILL Syntax: KILL;
Stops the step-by-step execution of the current program
(with debug).
Branch
In what follows, the plural word commands refers to both
a single command or a set of commands.
IF THEN Syntax: IF test THEN commands END;
Evaluate test. If test is true (not 0), execute commands.
Otherwise, nothing happens.
IF THEN ELSE Syntax: IF test THEN commands1 ELSE commands 2
END;
Evaluate test. If test is true (non 0), execute commands 1,
otherwise, execute commands 2
CASE Syntax:
CASE
IF test1 THEN commands1 END;
IF test2 THEN commands2 END;
…
[DEFAULT commands]
END;
Evaluates test1. If true, execute commands1 and end the
CASE. Otherwise, evaluate test2. If true, execute
commands2. Continue evaluating tests until a true is
found. If no true test is found, execute default commands,
if provided.
Example:
CASE
IF THEN RETURN "negative";
END;
IF THEN RETURN "small"; END;
DEFAULT RETURN "large";
END;
x 0
x 1