Null object: Difference between revisions

No change in size ,  12 years ago
Line 89:
 
=={{header|Babel}}==
In this example, we place nil on the stack, then perform an if-then-else (ifte) based on the value returned by the 'nil?' operator which returns true ofif top-of-stack (TOS) is nil. If TOS is nil, then we can be relieved, otherwise, the interpreter has gone absolutely haywire. The '<<' operator prints the selected string to STDOUT.
<lang babel>{ nil { nil? } { "Whew!\n" } { "Something is terribly wrong!\n" } ifte << }</lang>
 
Anonymous user