Undefined values: Difference between revisions

m (→‎{{header|Ring}}: Remove vanity tags)
Line 602:
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|Julia}}==
Julia has two different notions of undefined values:
 
1. During compilation, a variable name that is not recognized by the compiler causes an undefined variable error. For example, if the variable x has not been defined previously and is used on the right-hand side of an expression, this produces in the REPL cammand line:
<code>
julia> x + 1
ERROR: UndefVarError: x not defined
Stacktrace:
[1] top-level scope at none:0
</code>
<br />
2. For variables that are defined for the Julia program but have undefined values, there are two different notions of undefined value in Julia (version > 0.7): <code> nothing </code> and <code> missing </code>. "nothing" and "missing" are constants used by convention to refer to either (with <code> nothing </code> an absent result, such as a search with nothing found, or in the case of <code> missing </code> a data table containing missing values.
 
=={{header|Kotlin}}==
4,102

edits