Programming in HP PPL 529
CASE Syntax:
CASE
IF test1 THEN commands1 END;
IF test2 THEN commands2 END;
…
[DEFAULT commands]
END;
Evaluates test1. If true, executes commands1 and ends the
CASE. Otherwise, evaluates test2. If true, executes
commands2 and ends the CASE. Continues evaluating
tests until a true is found. If no true test is found, executes
default commands, if provided.
Example:
CASE
IF THEN RETURN "negative"; END;
IF THEN RETURN "small"; END;
DEFAULT RETURN "large";
END;
IFERR IFERR commands1 THEN commands2 END;
Executes sequence of commands1. If an error occurs
during execution of commands1, executes sequence of
commands2.
IFERR ELSE IFERR commands1 THEN commands2 ELSE
commands3 END;
Executes sequence of commands1. If an error occurs
during execution of commands1
, executes sequence of
commands2. Otherwise, execute sequence of
commands3.
Loop
FOR Syntax: FOR var FROM start TO finish DO commands END;
Sets variable var to start, and for as long as this variable
is less than or equal to finish, executes the sequence of
commands, and then adds 1 (increment) to var.
x 0
x 1