Page 21-30
Thus, we demonstrated the use of function INFORM. To see how to use these
input values in a calculation modify the program as follows:
« “ CHEZY’S EQN” { { “C:” “Chezy’s coefficient” 0} { “R:”
“Hydraulic radius” 0 } { “S:” “Channel bed slope” 0} } { } { 120
1 .0001} { 110 1.5 .00001 } INFORM IF THEN OBJ DROP C R S
‘C*(R*S)’ NUM “Q” TAG ELSE “Operation cancelled” MSGBOX
END »
The program steps shown above after the INFORM command include a
decision branching using the IF-THEN-ELSE-END construct (described in detail
elsewhere in this Chapter). The program control can be sent to one of two
possibilities depending on the value in stack level 1. If this value is 1 the
control is passed to the commands:
OBJ DROP C R S ‘C*√(R*S)’ NUM “Q” TAG
These commands will calculate the value of Q and put a tag (or label) to it. On
the other hand, if the value in stack level 1 is 0 (which happens when a @CANCEL
is entered while using the input box) , the program control is passed to the
commands:
“Operation cancelled” MSGBOX
These commands will produce a message box indicating that the operation was
cancelled.
Example 2
– To illustrate the use of item 3 (Field format information) in the
arguments of function INFORM, change the empty list used in program INFP1
to { 2 1 }, meaning 2, rather than the default 3, columns, and only one tab stop
between labels and values. Store this new program in variable INFP2:
Note: Function MSGBOX belongs to the collection of output functions under
the PRG/OUT sub-menu. Commands IF, THEN, ELSE, END are available
under the PRG/BRCH/IF sub-menu. Functions OBJ, TAG are available
under the PRG/TYPE sub-menu. Function DROP is available under the PRG/
STACK menu. Functions and NUM are available in the keyboard.