Equivalent of Do-While?

Discussion in 'Python' started by Code_Dark, Nov 6, 2003.

  1. Code_Dark

    Code_Dark Guest

    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 . Just take up the NOSPAM-
    part ;-)

    Thanks in advance,

    - Code_Dark
     
    Code_Dark, Nov 6, 2003
    #1
    1. Advertising

  2. Code_Dark wrote:

    > 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).


    Use something like

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

    --
    Erik Max Francis && && 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
     
    Erik Max Francis, Nov 6, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ^CrazyCoder^
    Replies:
    3
    Views:
    7,270
    Terrence Benade
    Sep 15, 2003
  2. David
    Replies:
    1
    Views:
    498
    David
    Jul 19, 2004
  3. Steven

    while loop in a while loop

    Steven, Mar 24, 2005, in forum: Java
    Replies:
    5
    Views:
    2,241
    Tim Slattery
    Mar 30, 2005
  4. Sam
    Replies:
    0
    Views:
    417
  5. Timothy Fitz

    while 1 vs while True

    Timothy Fitz, Dec 13, 2004, in forum: Python
    Replies:
    16
    Views:
    632
    Terry Reedy
    Dec 15, 2004
Loading...

Share This Page