2 Replies Latest reply: Dec 4, 2012 6:47 AM by odie_63 RSS

    Exiting a for loop in the middle of iteration in XQuery


      I have below xquery block:

      for $line in $body/input/item
      if($line eq "E") then (
      return "1"

      My task here is I have to iterate through all the line items and if I encounter "E" even in single case I have to exit imediately the for loop by returning "1", if it is not "E" for all the line items then at the end I shud return "0"

      Here I'm not able to exit the for loop. Do we have any predefined keyword for exiting the loop?

      Thanks in advance.