Equivalent of Do-While?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Code_Dark

    Equivalent of Do-While?

    Hi, I'm coming over to python from C and C++, and I was just wondering
    if there's an equivalent of the Do-While fuction that I'm so fond
    of... I really like it, and it's handy for asking the user if they'd
    like to repeat a program (or parts of a program). Please reply to this
    or email me at dshaw858@NOSPAM-hotmail.com. Just take up the NOSPAM-
    part ;-)

    Thanks in advance,

    - Code_Dark
  • Erik Max Francis

    #2
    Re: Equivalent of Do-While?

    Code_Dark wrote:
    [color=blue]
    > Hi, I'm coming over to python from C and C++, and I was just wondering
    > if there's an equivalent of the Do-While fuction that I'm so fond
    > of... I really like it, and it's handy for asking the user if they'd
    > like to repeat a program (or parts of a program).[/color]

    Use something like

    while True:
    ... do something ...
    if not condition:
    break
    ... do something more ...

    --
    Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
    __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
    / \ The color is red / Under my shoe
    \__/ Neneh Cherry

    Comment

    Working...