actually, my test did work. I was testing to see if the loop would end
when the condition was met and it wasn't being tested directly.

It was only a test, and not meant to be a counter loop, just that is was
in a loop, and each increment after 3 was printed to show it was still
inside the loop (which I expected, since it would only drop out of the
loop when it hits the WHILE expression DO statement).

George

> -----Original Message-----
> From: [email protected] [mailto:owner-u2-
> [email protected]] On Behalf Of Jacques G.
> Sent: Friday, February 27, 2009 12:16 PM
> To: [email protected]
> Subject: Re: [U2] DO/WHILE vs IF THEN
>
> CTR =0
> LOOP WHILE CTR < 4
>   CTR+=1
>   PRINT CTR
> REPEAT
>
> FOR CTR = 0 TO 4
>    PRINT CTR
> NEXT CTR
>
> CTR = 0
> LOOP
>   CTR += 1
>   PRINT CTR
>   IF CTR > 4 THEN EXIT
> REPEAT
>
>
> If you're going to use a counter, might as well use a for loop.  Your
> test didn't work because you didn't test the limit after each
> increment.  Repeating the increment and print statement like your
> example does defeats the purpose of the loop.
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to