Re: Good python equivalent to C goto

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jean-Paul Calderone

    Re: Good python equivalent to C goto

    On Sat, 16 Aug 2008 23:20:52 +0200, Kurien Mathew <kmathew@envivi o.frwrote:
    >Hello,
    >
    >Any suggestions on a good python equivalent for the following C code:
    >
    >while (loopCondition)
    >{
    if (condition1)
    goto next;
    if (condition2)
    goto next;
    if (condition3)
    goto next;
    stmt1;
    stmt2;
    >next:
    stmt3;
    stmt4;
    }
    >
    >
    Goto isn't providing much value over `if´ in this example. Python has
    a pretty serviceable `if´ too:

    while loopCondition:
    if not (condition1 or condition2 or condition3):
    stmt1
    stmt2
    stmt3
    stmt4

    Jean-Paul
Working...