+ 1

i = 0 while 1==1: print(i) i = i + 1 if i >= 5: print("Breaking") break print("Finished")

what 1==1 in while tag represents?

23rd Feb 2018, 9:48 PM
Deepak Kumar
Deepak Kumar - avatar
3 ответов
+ 2
what will happen if its false?
23rd Feb 2018, 9:52 PM
Deepak Kumar
Deepak Kumar - avatar
+ 2
ok
23rd Feb 2018, 9:54 PM
Deepak Kumar
Deepak Kumar - avatar
+ 1
it would print 0 1 2 3 4 5 breaking finished. the point of 1==1 is to make an infinite loop and then add a condition inside it to break it
23rd Feb 2018, 10:53 PM
Dominique Abou Samah
Dominique Abou Samah - avatar