why no "do : until"?

Greg Jorgensen gregj at pobox.com
Mon Jan 1 22:45:41 EST 2001


"D-Man" <dsh8290 at rit.edu> wrote:

> How about
>
> until x > 25 :
> ..
> This may remove the "while 1" argument for most cases too!

That's equivalent to the while loop. Your example is the same as while x <=
25. while (1) would be writtent until (0). We're talking about how a loop
with the test "at the bottom" could work, like this C code:

  do {
      ...
  } until (condition);

This breaks Python's indentation rules for blocks, though. The Python
equivalent is:

  while (1):
      ....
      if (condition): break

--
Greg Jorgensen
PDXperts
Portland, Oregon, USA
gregj at pobox.com






More information about the Python-list mailing list