Null object: Difference between revisions

Content added Content deleted
(Added F# version)
(→‎{{header|ooRexx}}: Extended the example and added output)
Line 682: Line 682:
</lang>
</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:
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>
<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("INPUT") then say "Variable INPUT is not assigned"
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
</pre>


=={{header|Oz}}==
=={{header|Oz}}==