A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/083478.html below:

do...until wisdom needed...

do...until wisdom needed...Ken Peek Peek at LVCM.comNOSPAM
Mon Apr 16 00:44:08 EDT 2001
Sometimes, when writing code, I find it would be nice if there were a
"do...until" construct in Python.  This would be preferable to using a "while"
construct if you wanted to make sure the loop will execute at least once.  You
CAN do this with a "while" construct, but it requires fiddling with the loop
condition before the "while" construct, which is "messy".  An example:

condition = TRUE   # make sure loop runs at least once
while (condition):
    # do some stuff
    # do some more stuff
    condition = whatever_stops_the _loop

Here is my question--  If Python WERE to have a "do...until" construct, what
would be the best way to implement the syntactical rules?

For example:

do:
    # some stuff
    # some more stuff
    until (condition == TRUE)   # ("until" must be last statement or there is an
error)

OR:

do:
    # some stuff
    # some more stuff
until (condition == TRUE)

OR: ???




More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4