The IFERR 7 THEN 7 ELSE 7 END Structure
The syntax for this structure is
«… IFERR
THEN
The commands in the
To enter IFERR 7 THEN 7 ELSE 7 END in a program:
Press !°LL%ERROR% @%IFERR%
Example: The following program prompts for two numbers, then adds them. If only one number is supplied, the program displays an error message and prompts again.
Program: | Comments: |
|
|
« |
|
DO | Begins the main loop. |
"KEY IN a AND b" " " | Prompts for two numbers. |
INPUT OBJ→ |
|
UNTIL | Starts the loop test clause. |
IFERR | The error trap contains only the + |
+ | command. |
THEN | If an error occurs, recalls and displays the |
ERRM 5 DISP | Too Few Arguments message for 2 |
2 WAIT | seconds, then puts 0 (false) on the stack for |
0 | the main loop. |
| |
ELSE | If no error occurs, puts 1 (true) on the stack |
1 | for the main loop. |
END | Ends the error trap. |
END | Ends the main loop. If the error trap left 0 |
| (false) on the stack, the main loop repeats — |
| otherwise, the program ends. |
» |
|
|
|