Re: Repeat-While vs. Repeat-Until

>Is there any difference in these two constructs as to when the condition is
>evaluated? In particular, I am looking for a construct that will evaluate
>the condition FIRST before the action is even executed one time. It is
>unclear from the documentation when the condition is evaluated for each of
>these constructs.
>
>I understand the difference between the two constructs with respect to
>functionality (repeat-while performs an action while a condition is true,
>repeat-until performs an action until a condition becomes true). I just
>don't understand when the condition is evaluated.

Many years ago, when I used to teach programming, the standard way to 
characterize these constructions differed in exactly this way. 
Repeat-while tests for the condition, exits if it is false and does 
the operation if the condition is true, then loops. Repeat-until does 
the operation, tests for the condition, exits if it is true, and 
otherwise loops. So while while may never act, until always acts at 
least once. I'd recommend this, it is very handy.

Pat Hayes

>Thanks,
>
>Craig
>
>---------------------------------
>Craig Schlenoff
>Mechanical Engineer
>Knowledge Systems Group
>Intelligent Systems Division
>Manufacturing Engineering Laboratory
>National Institute of Standards and Technology (NIST)
>100 Bureau Drive, Stop 8230
>Gaithersburg, MD 20899-8230
>Phone: 301-975-3456
>Fax: 301-990-9688
>Email: craig.schlenoff@nist.gov


-- 
---------------------------------------------------------------------
IHMC	(850)434 8903 or (650)494 3973   home
40 South Alcaniz St.	(850)202 4416   office
Pensacola			(850)202 4440   fax
FL 32501			(850)291 0667    cell
phayes@ihmc.us       http://www.ihmc.us/users/phayes

Received on Wednesday, 5 May 2004 10:50:53 UTC