Kurien Mathew wrote:
> 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;
>   }

I think the most direct translation would be this:

def whateverfunc():

    def next_func():
        stmt3
        stmt4

    while loopCondition:
        if condition1:
            next_func()
            return
        if condition2:
            next_func()
            return
        if condition3:
            next_func()
            return
        stmt1
        stmt2



        
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to