Null object: Difference between revisions

Content added Content deleted
(Add NetRexx implementation)
([Erlang] Explain lack of undefined value. Show alternatives.)
Line 265: Line 265:


<lang e>object == null</lang>
<lang e>object == null</lang>

=={{header|Erlang}}==

Erlang does not have an undefined value. As an alternative, many applications tend to pick a convention for return values and use that.

Example alternatives:
# Something like {ok, 3} or {err, no_more} on error.
# Don't ever allow an undefined return value, and throw an exception instead.
# Return an atom:
# undefined*
# undef
# null
# nil
# none

* Often used by records as an initial value and the stdlib module.

Atoms are erlang's user-defined constants that always evaluates to is itself. It is also equal to no other value else but itself.


=={{header|Factor}}==
=={{header|Factor}}==