IF command

From m204wiki
Revision as of 16:11, 22 March 2017 by ELowell (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

Privileges
Any user
Function
Executes a procedure if a condition is satisfied

Syntax

IF global-variable=value, {procnumber | procname} [delimiter response [delimiter response...]]

Where:

global-variable The name of the global variable whose value is to be tested.
value The value for which the global variable is to be tested. If this value matches the value of the global variable, the specified procedure is executed (INCLUDEd).
procnumber The number of an existing temporary procedure. It can be zero or a negative number.
procname The name of an existing procedure.
delimiter One of the following characters:
Character name Keyboard display
Blank
Comma ( , )
Equal sign ( = )
Left parenthesis ( ( )
Right parenthesis ( ) )
response A dummy string or $READ function response. Any number of responses can be specified on a command line, separated by delimiters.

Syntax notes

If dummy string and $READ responses are specified on the same command line, dummy string responses must appear first.

Example

PROCEDURE REPORT BEGIN . . . END IF REPORTNO = 1, REPA,YES,NO IF REPORTNO = 2, REPB IF REPORTNO = 3, REPC END PROCEDURE

Usage notes

  • The IF command conditionally executes a procedure or a recent SOUL request. The INCLUDE command unconditionally executes a procedure. (The presentation of the INCLUDE command describes procedure execution.) If the value specified in the command matches the value of the specified global variable, Model 204 executes the procedure.
  • As dummy strings and $READ functions are encountered in the procedure, responses are retrieved, one by one, from the responses specified in the IF command, as shown in the example.

    For further discussion of dummy strings and the $READ function, see Dummy strings in procedures.