On 2008-08-16, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sat, 16 Aug 2008 23:20:52 +0200, Kurien Mathew <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> 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; >> } >> > > Nasty code even for C... I've never used goto in C...
I do sometimes, but it's for exception handling, and in Python one uses try/raise/except. The example above isn't the best way to show this, but perhaps something like the code below while loopCondition: try: if condition 1: raise MyException if condition 2: raise MyException if condition 3: raise MyException stmt1; stmt2; stmt3; except: MyException pass stmt4; stmt5; -- Grant Edwards grante Yow! People humiliating at a salami! visi.com -- http://mail.python.org/mailman/listinfo/python-list