Null object: Difference between revisions
→{{header|ooRexx}}: Extended the example and added output
(Added F# version) |
Walterpachl (talk | contribs) (→{{header|ooRexx}}: Extended the example and added output) |
||
Line 682:
</lang>
Uninitialized ooRexx variables do not evaluate to .nil, but rather the character string name of the variable (all uppercase). The var() built-in function allows variable validity to be tested:
<lang ooRexx>a=.array~of('A','B')
i=3
if \var("INPUT") then say "Variable INPUT is not assigned". ▼
if a[i] == .nil then say "Item" i "of array A is missing"
</lang>▼
if \var("var") then say "Variable" var "is not assigned"</lang>
Output:
<pre>
Item 3 of array A is missing
Variable INPUT is not assigned
Variable VAR is not assigned
=={{header|Oz}}==
|