[xquery-talk] Can I have multiple if's in a for loop (Not if-else
if, but if, if, if..)
sudheshna iyer
sudheshnaiyer at yahoo.com
Mon Apr 18 06:12:23 PDT 2011
Thank you Johyn. I was missing comma operator..
----- Original Message ----
From: John Snelson <john.snelson at marklogic.com>
To: talk at x-query.com
Sent: Mon, April 18, 2011 5:33:48 AM
Subject: Re: [xquery-talk] Can I have multiple if's in a for loop (Not if-else
if, but if, if, if..)
On 18/04/11 09:54, sudheshna iyer wrote:
> Can I have multiple if's in a for loop? I noticed that it works, if I use -->
> if (ONE) then ...else if (TWO) then ... else if (THREE) then .. else()
> But I want all the three if "ReturnParameterCode" is repeated with all the
>three
> values
Sure, use parentheses and the comma operator, like this:
for $a in (1 to 10)
return (
if(ONE) then ... else (),
if(TWO) then ... else (),
if(THREE) then .. else ()
)
John
-- John Snelson, Senior Engineer http://twitter.com/jpcs
MarkLogic Corporation http://www.marklogic.com
_______________________________________________
talk at x-query.com
http://x-query.com/mailman/listinfo/talk
More information about the talk
mailing list