To maintain execution if an error occurs, the
B command is
placed inside an IFERR clause. Because no action is required when
an error occurs, the THEN clause contains no commands.
• Enabling LAST. In case an error occurs, LAST must be enabled to
return the argument to the stack. BDISP sets flag 31 to pro-
grammatically enable the LAST recovery feature.
• FOR ... NEXT loop (definite loop with counter). BDISP executes a
loop from 1 to 4, each time displaying
in a different base on a
The loop counter (named
in this program) is a local variable. It's
created by the FOR ... NEXT program structure (rather than by a
command) and it's automatically incremented by NEXT.
• Subprograms. BDISP demonstrates three uses for subprograms.
1. BDISP contains a main subprogram and a call to PRESERVE.
The main subprogram goes on the stack and is evaluated by
2. When BDISP creates a local variable for n, the defining pro-
gram is a subprogram.
3. There are four subprograms that "customize" the action of the
loop. Each subprogram contains a command to change the bi-
nary base, and each iteration of the loop executes one of these
• PAD (page 257) expands a string to 23 characters so that DISP
shows it right-justified.
• PRESERVE (page 258) stores the current status, executes the main
subprograms and restores the status.
28: Programming Examples