[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "While" Loop EL question



PureBytes Links

Trading Reference Links

>When using a "While" loop in EL, at some point (hopefully) in the loop the
>"while" condition changes, ending the looping.  My question is, does the
>program jump out of the loop the instant the condition changes, or does it
>complete the loop it's currently on?

It completes the loop.  The condition is only evaluated at the beginning
of each loop, and at no other time.

I always thought EL's loops were weak.  They need an "Exit Loop"
statement that can abort the loop in the middle, similar to 'break'
in C/C++/Java.  To get around this you need to have tests inside the
loop that change a variable that gets tested at the beginning of
each loop.

-- 
  ,|___    Alex Matulich -- alex@xxxxxxxxxxxxxx
 // +__>   Director of Research and Development
 //  \ 
 // __)    Unicorn Research Corporation -- http://unicorn.us.com