Page 1 of 1

repeat loop - exit to top

Posted: Sun Feb 22, 2015 7:30 pm
by jalz
Hey all,

I have a repeat loop. There are two conditions I want to check for - if both are true I don't want to execute any code below the if condition, I just want to loop back to top increment my tIndex by 1 and then work my way down the loop if the condition is not met. I know I can block the code in an if -- end if, however I was looking at the way live code works - and came across the exit to top. Is that what it's not used for?

Thanks
Jalz

Code: Select all


repeat for each key tIndex in tGrid
      
      -- if its estimate and optional(label 4) don't continue with the code to go down the loop but reiterate after incrementing
      if (tHeader["Label"][1] is "Estimate") and (tGrid[tIndex]["Label 4"] is true) then exit to top
      
      put "PrintLines" & tIndex into tPrintLines

end repeat


Re: repeat loop - exit to top

Posted: Sun Feb 22, 2015 7:58 pm
by Klaus
Hi Jlaz,

not exactly sure what you are after, but "exit to top" will leave the current handler, that is correct.
Maybe you are looking for "exit repeat"? That will only leave, well, you guessed, the repeat loop. :D


Best

Klaus

Re: repeat loop - exit to top

Posted: Sun Feb 22, 2015 9:29 pm
by dunbarx
Hi,

Is it possible the "next repeat" is what you are looking for?

Craig Newman

Re: repeat loop - exit to top

Posted: Mon Feb 23, 2015 12:12 am
by jalz
Thank you, ive got around it in an If then Else, but I believe next repeat was what I was looking for. Something to remember for the future :D