IF command: Difference between revisions
Jump to navigation
Jump to search
(Automatically generated page update) |
mNo edit summary |
||
Line 6: | Line 6: | ||
<dd>Executes a procedure if a condition is satisfied | <dd>Executes a procedure if a condition is satisfied | ||
</dl> | </dl> | ||
==Syntax== | ==Syntax== | ||
<p class="syntax">IF <i>global-variable=value</i>, {<i>procnumber</i> | <i>procname</i>} | <p class="syntax">IF <i>global-variable=value</i>, {<i>procnumber</i> | <i>procname</i>} | ||
Line 14: | Line 15: | ||
<table> | <table> | ||
<tr> | <tr> | ||
<th>global-variable</th> | <th nowrap>global-variable</th> | ||
<td> | <td>The name of the global variable whose value is to be tested.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<th>value</th> | <th>value</th> | ||
<td> | <td>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).</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<th>procnumber</th> | <th>procnumber</th> | ||
<td> | <td>The number of an existing temporary procedure. It can be zero or a negative number.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<th>procname</th> | <th>procname</th> | ||
<td> | <td>The name of an existing procedure.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<th>delimiter</th> | <th>delimiter</th> | ||
<td> | <td>One of the following characters: | ||
<table> | |||
<table> | |||
<tr> <th>Character name </th> <th>Keyboard display</th> </tr> | <tr class="head"> <th>Character name </th> <th>Keyboard display</th> </tr> | ||
<tr> <th><var>Blank</var></th> <td></td> </tr> | <tr> <th><var>Blank</var></th> <td></td> </tr> | ||
<tr> <th><var>Comma</var></th> <td>( , ) </td> </tr> | <tr> <th><var>Comma</var></th> <td>( <b>,</b> ) </td> </tr> | ||
<tr> <th><var>Equal sign </var></th> <td>( = ) </td> </tr> | <tr> <th><var>Equal sign </var></th> <td>( <b>=</b> ) </td> </tr> | ||
<tr> <th><var>Left parenthesis </var></th> <td>( ( )</td> </tr> | <tr> <th><var>Left parenthesis </var></th> <td>( <b>(</b> )</td> </tr> | ||
<tr> <th><var>Right parenthesis </var></th> <td>( ) )</td> </tr> | <tr> <th><var>Right parenthesis </var></th> <td>( <b>)</b> )</td> </tr> | ||
</table> | </table> | ||
</td> | </td> | ||
Line 56: | Line 56: | ||
<tr> | <tr> | ||
<th>response</th> | <th>response</th> | ||
<td> | <td>A dummy string or $READ function response. Any number of responses can be specified on a command line, separated by delimiters.</td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
===Syntax notes=== | ===Syntax notes=== | ||
If dummy string and $READ responses are specified on the same command line, dummy string responses must appear first. | If dummy string and $READ responses are specified on the same command line, dummy string responses must appear first. | ||
==Example== | ==Example== | ||
<p class="code">PROCEDURE REPORT | <p class="code">PROCEDURE REPORT | ||
Line 74: | Line 75: | ||
END PROCEDURE | END PROCEDURE | ||
</p> | </p> | ||
==Usage notes== | ==Usage notes== | ||
< | <ul> | ||
< | <li>The <var>IF</var> command conditionally executes a procedure or a recent SOUL request. The <var>INCLUDE</var> command unconditionally executes a procedure. (The presentation of the <var>INCLUDE</var> command describes procedure execution.) If the value specified in the command matches the value of the specified global variable, <var class="product">Model 204</var> executes the procedure. </li> | ||
<li>As dummy strings and $READ functions are encountered in the procedure, responses are retrieved, one by one, from the responses specified in the <var>IF</var> command, as shown in the example. | |||
<p> | |||
For further discussion of dummy strings and the $READ function, see [[Procedures#Dummy strings in procedures|Dummy strings in procedures]].</p></li> | |||
</ul> | |||
[[Category: General user commands]] | [[Category: General user commands]] | ||
[[Category:Commands]] | [[Category:Commands]] |
Revision as of 21:08, 15 April 2014
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:
|
||||||||||||
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.