Special variables: Difference between revisions
Content deleted Content added
→{{header|Julia}}: sort names |
m →{{header|REXX}}: changed some comments in the REXX section header, removed STYLE from the PRE html TAG, aligned some statements. |
||
Line 1,302:
The REXX language has three special variables:
:::* '''RC''' [the '''r'''eturn '''c'''ode from commands issued to the host]
:::* '''RESULT''' [the result RETURNed from a subroutine or function]
:::* '''SIGL''' [the source line number that did the transfer of control]
Each of the above may be used as a regular REXX variable
<br>Because REXX may define (or re-define) any of these variables during execution of the REXX program,
Initially, the above three special variables aren't defined (until the appropriate action for their use has been performed).
Line 1,314:
: If no subroutines have been invoked, then the '''RESULT''' special variable isn't defined.
: If no SIGNAL or CALL (or subroutine invocation) has been used, then the '''SIGL''' special variable isn't defined.
:::: (This excludes the use of:
:::::::* '''SIGNAL ON ααα'''
:::::::* '''SIGNAL OFF ααα'''
:::: which don't actually transfer control.)
In each case, the three special variable names ('''RC''', '''RESULT''', and '''SIGL''') may be in lower/upper/mixed case.
<br><br>The scope of the special variables is LOCAL.
<lang rexx>/*REXX program
/*line two. */
/*line three.*/ say copies('
rc=1/3 /*line four. */
signal youWho /*line five. */
myLoo='this got skipped' /*line six. */
youwho: /*line seven.*/
sep=copies('─', 9) /*line eight.*/
say
say sep 'REXX source statement' SIGL '=' sourceline(sigl)
say copies('
g=44
call
say sep 'rc=' rc
say sep 'result=' result
say copies('
h=66
hh=
say sep 'rc=' rc
say sep 'result=' result
say sep 'hh=' hh
say copies('
'DIR
say sep 'rc=' rc
say sep 'result=' result
say copies('
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────HALVE subroutine────────────────────*/
'''output'''
<pre>
═══════════════════════════════════════════════════════════════════════════════
───────── SIGL= 5
───────── REXX source statement 5 = signal youWho /*line five. */
═══════════════════════════════════════════════════════════════════════════════
───────── rc= 0.333333333
───────── result= 22
═══════════════════════════════════════════════════════════════════════════════
───────── rc= 0.333333333
───────── result= 22
───────── hh= 33
═══════════════════════════════════════════════════════════════════════════════
Documents and Settings
Program Files
Recycled
System Volume Information
TEMP
WINDOWS
───────── rc= 0
───────── result= 22
═══════════════════════════════════════════════════════════════════════════════
</pre>
|