Null object: Difference between revisions

 
Line 1,193:
Null can be compared for directly, using equality operators. Operators ending with a ? mark propagate null. A null in an expression test is a non-truthy result.
 
<syntaxhighlight lang="langur">val .x, .y = true, null
var x, y = true, null
 
writeln .x == null
writeln .y == null
writeln .x ==? null
writeln .y ==? null
 
# null not a "truthy" result
writeln if(null: 0; 1)</syntaxhighlight>
</syntaxhighlight>
 
{{out}}
990

edits