Null object: Difference between revisions
Content added Content deleted
LalaithMeren (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 1,193: | 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. |
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"> |
<syntaxhighlight lang="langur"> |
||
var x, y = true, null |
|||
writeln |
writeln x == null |
||
writeln |
writeln y == null |
||
writeln |
writeln x ==? null |
||
writeln |
writeln y ==? null |
||
# null not a "truthy" result |
# null not a "truthy" result |
||
writeln if(null: 0; 1) |
writeln if(null: 0; 1) |
||
</syntaxhighlight> |
|||
{{out}} |
{{out}} |