Jump to content

Null object: Difference between revisions

m
[Erlang] Format cleanup, improve wording.
m ([Erlang] Format code clearly.)
m ([Erlang] Format cleanup, improve wording.)
Line 268:
=={{header|Erlang}}==
 
Erlang does not have an undefinednull valueobject. As an alternative, many applications tend to pick a convention for returnreturning valuesan empty condition and use that.
 
Example alternatives:
# Something like <pre>{ok, 3} % normal case</pre> or <pre>{err, no_more} % error case</pre> on error.
# Don't ever allow an undefined return value, and throw an exception instead.
# Return an atom:
## <pre>'''undefined</pre>'''*
## <pre>'''undef</pre>'''
## <pre>'''null</pre>'''
## <pre>'''nil</pre>'''
## <pre>'''none</pre>'''
 
<pre>'''undefined</pre>''' is 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.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.