Null object: Difference between revisions

Added Elixir
(Added Elixir)
Line 343:
if not Assigned(lObject) then
...</lang>
 
=={{header|Déjà Vu}}==
There isn't an actual null object, so generally falsy objects are used to indicate a missing value, or when that's impractical a specific ident:
Line 405 ⟶ 406:
end</lang>
{{out}}<pre>s = Void</pre>
 
=={{header|Elixir}}==
<code>nil</code> is atom in fact:
<lang elixir>iex(1)> nil == :nil
true
iex(2)> is_nil(nil)
true</lang>
<code>nil</code> is thought of as being <code>false</code> in the conditional expression.
 
If the condition given to <code>if/2</code> returns <code>false</code> or <code>nil</code>, the body given between <code>do</code>/<code>end</code> is not executed and it simply returns <code>nil</code>.
<lang elixir>iex(3)> if nil, do: "not execute"
nil</lang>
 
=={{header|Erlang}}==
Anonymous user