Re: Understanding while...else...

2013-01-23 Thread René Klačan
k" statement and this is common mistake On Wed, Jan 23, 2013 at 12:03 PM, René Klačan wrote: > they wouldnt be equivalent if #staff in version 1 did not cointain "break" > statement and this is common mistake > > > On Wed, Jan 23, 2013 at 1:39 AM, Oscar Benjamin <

Re: Understanding while...else...

2013-01-23 Thread René Klačan
they wouldnt be equivalent if #staff in version 1 did not cointain "break" statement and this is common mistake On Wed, Jan 23, 2013 at 1:39 AM, Oscar Benjamin wrote: > On 22 January 2013 23:41, Terry Reedy wrote: > > On 1/22/2013 3:09 PM, Ethan Furman wrote: > >> > >> On 01/22/2013 09:44 AM, Te

Re: Else statement executing when it shouldnt

2013-01-22 Thread René Klačan
it seems that lot of you are forgeting about this case: for i in [1,2,3,4,5]: print i else: print('this will be printed also because cycle wasnt broke') so the one case when else branch is executed is when condition is not satisfied and the other case is when there is no break executed du

Re: Else statement executing when it shouldnt

2013-01-20 Thread René Klačan
ranch 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 wrote: > On Sunday, January 20, 2013 8:54:13 PM UTC-8, René Klačan wrote: > > You

Re: Else statement executing when it shouldnt

2013-01-20 Thread René Klačan
ranch 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 wrote: > On Sunday, January 20, 2013 8:54:13 PM UTC-8, René Klačan wrote: > > You

Re: Else statement executing when it shouldnt

2013-01-20 Thread René Klačan
You have to break while loop not to execute else branch Rene On Mon, Jan 21, 2013 at 5:40 AM, eli m wrote: > an else statement is running when it shouldnt be. It is on the last line. > Whenever i am in the math or game function, when i type in main, it goes > back to the start of the program, b