Changes

Jump to navigation Jump to search
502 bytes removed ,  15:18, 31 October 2023
no edit summary
The expression returns <code>ok</code> if the effective boolean value of <code>$test</code> is true, and it returns <code>fails</code> otherwise.
 
==Elvis Operator==
 
The Elvis operator is also available in other languages. It is sometimes called [https://en.wikipedia.org/wiki/Null_coalescing_operator null-coalescing operator]. In XQuery, the value of the first operand will be returned if it is a non-empty sequence. Otherwise, the value of the second operand will be returned.
 
<syntaxhighlight lang="xquery">
(: if/then/else :)
if (exists($argument)) then $argument else 0
(: elvis operator :)
$argument ?: -1
</syntaxhighlight>
 
The behavior of the operator is equivalent to the {{Function|Utility|util:or}} function.
==If Without Else==
)
</syntaxhighlight>
 
The behavior of the if expression is equivalent to the {{Function|Utility|util:if}} function.
=Functions=
;Version 11:
* Removed: Elvis operator <code>?:</code>, in favor of the new <code>[https://qt4cg.org/specifications/xquery-40/xquery-40.html#id-otherwise otherwise]</code> expression.
* Updated: Renamed from {{Code|non-deterministic}} to {{Code|nondeterministic}}.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu