Examples:

# else branch will be executed
i = 0
while i < 5:
    i += 1
else:
    print('loop is over')


# else branch will be executed
i = 0
while i < 5:
    i += 1
    if i == 7:
        print('i == 7')
        break
else:
    print('loop is over')


# else branch wont be executed
i = 0
while i < 5:
    i += 1
    if i == 3:
        print('i == 3')
        break
else:
    print('loop is over')

On Mon, Jan 21, 2013 at 5:57 AM, eli m <techgeek...@gmail.com> wrote:

> On Sunday, January 20, 2013 8:54:13 PM UTC-8, René Klačan wrote:
> > You have to break while loop not to execute else branch
> >
> >
> > Rene
> >
> >
> >
> Can you explain in more detail please.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to