468,161 Members | 1,946 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,161 developers. It's quick & easy.

Re: Good python equivalent to C goto

On Sat, 16 Aug 2008 23:20:52 +0200, Kurien Mathew <km*****@envivio.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
Aug 16 '08 #1
0 753

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

226 posts views Thread by Stephen C. Waterbury | last post: by
20 posts views Thread by BJ MacNevin | last post: by
28 posts views Thread by David MacQuigg | last post: by
2 posts views Thread by ajikoe | last post: by
13 posts views Thread by Steven Bethard | last post: by
22 posts views Thread by Kurien Mathew | last post: by
1 post views Thread by gcdp | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.