Undefined values: Difference between revisions

Lingo added
(Lingo added)
Line 584:
For example, suppose it is agreed that the "sum" of the elements of an empty array should be null. Then one can simply write:
<lang jq>def sum: reduce .[] as $x (null; . + $x);</lang>
 
=={{header|Lingo}}==
In Lingo an undefined variable has the value <Void>. If a variable is <Void> (i.e. undefined) can be checked with function voidP():
<lang lingo>put var
-- <Void>
put voidP(var)
-- 1
var = 23
put voidP(var)
-- 0</lang>
 
=={{header|Logo}}==
Anonymous user