Reputation: 28901
I wish to do the following:
let $foo :=
if (5 = 5)
then
return <bye/>
else
return <hi/>
But unfortunately the above doesn't work.
How do I do if statments for let statements.
Upvotes: 4
Views: 3736
Reputation: 440
You want to do something like:
let $foo :=
if (5 = 5) then
<bye/>
else
<hi/>
then you can return the result with
return
$foo
I suggest you download basex editor from http://files.basex.org/releases/latest/ in order to test any xquery. It's fast, and can highlight errors for you.
Also take a look at http://xqdoc.org/xquery-style.html for examples on writing clean xquery code.
Upvotes: 7