IF command: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
No edit summary
 
(One intermediate revision by one other user not shown)
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> is the name of the global variable whose value is to be tested.</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> is 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>
<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> is the number of an existing temporary procedure. It can be zero or a negative number.</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> is the name of an existing procedure.</td>
<td>The name of an existing procedure.</td>
</tr>
</tr>
   
   
<tr>
<tr>
<th>delimiter</th>
<th>delimiter</th>
<td> is one of the following characters:
<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> is a dummy string or $READ function response. Any number of responses can be specified on a command line, separated by delimiters.</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==
<p>The IF command conditionally executes a procedure or a recent User Language 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, <var class="product">Model&nbsp;204</var> executes the procedure. </p>
<ul>
<p>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. </p>
<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&nbsp;204</var> executes the procedure. </li>
<p>The <var class="book">Model&nbsp;204 User Language Manual</var> discusses dummy strings and the $READ function in detail.</p>
 
[[Category: General user commands]]
<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: User commands]]
[[Category:Commands]]
[[Category:Commands]]

Latest revision as of 16:11, 22 March 2017

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.