Null object: Difference between revisions

Content added Content deleted
(BASIC)
(→‎Icon and Unicon: combined headers)
Line 273: Line 273:
Just v -> "It's not Nothing; it is " ++ show v ++ "."</lang>
Just v -> "It's not Nothing; it is " ++ show v ++ "."</lang>


== Icon and Unicon ==
=={{header|Icon}} and {{header|Unicon}}==
Icon/Unicon have a [[Icon%2BUnicon/Intro#null|null value/datatype]]. It isn't possible to undefine a variable.
Icon/Unicon have a [[Icon%2BUnicon/Intro#null|null value/datatype]]. It isn't possible to undefine a variable.


==={{header|Icon}}===
<lang Icon>procedure main()
<lang Icon>procedure main()
nulltest("a",a) # unassigned variables are null by default
nulltest("a",a) # unassigned variables are null by default
Line 287: Line 286:
return write(name, if /var then " is" else " is not"," null.")
return write(name, if /var then " is" else " is not"," null.")
end</lang>
end</lang>
==={{header|Unicon}}===
This Icon solution works in Unicon.


=={{header|Io}}==
=={{header|Io}}==