Jump to content

Null object: Difference between revisions

no edit summary
(→‎min: add)
No edit summary
Line 808:
<syntaxhighlight lang="elixir">iex(3)> if nil, do: "not execute"
nil</syntaxhighlight>
 
=={{header|EMalL}}==
<syntaxhighlight lang="emal">
^|
| EMal has the Variable type (and its keyword var) that is the nullable universal supertype.
| EMal has the Void type (and its keyword void) that holds only one value: null.
| EMal has not nullable types (logic, int, real, text, blob), but null equality is always allowed.
|^
var a # defaults to null
int b # defaults to 0
void c # only one allowed value: null
writeLine("nullable var equals with not nullable int: " + (a == b)) # allowed, false
writeLine("type of a equals to Void data type: " + (generic!a == void)) # true: if the data type of a is void we are sure that a is null
writeLine("integer value " + b + " equals to null: " + (b == null)) # allowed, always false
writeLine("a void value equals to null: " + (c == null)) # always true
</syntaxhighlight>
{{out}}
<pre>
nullable var equals with not nullable int: ⊥
type of a equals to Void data type: ⊤
integer value 0 equals to null: ⊥
a void value equals to null: ⊤
</pre>
 
=={{header|Erlang}}==
224

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.