why the '1==1' was defined after 'while'? when the '1==1' was replaced by 'i==i',we get the same result, why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why the '1==1' was defined after 'while'? when the '1==1' was replaced by 'i==i',we get the same result, why?

1st Jun 2018, 5:18 PM
leekuy
4 Answers
+ 7
did you mention this code?? https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2281/ as here define infinite loop and it will terminate by break keyword
1st Jun 2018, 5:22 PM
Scooby
Scooby - avatar
+ 7
i = 0 while i==i: print(i) i = i + 1 if i >= 5: print("Breaking") break print("Finished") if you consider here for while i==i: i=0.. its mean its check 0==0 its mean in Boolean logic said if condition true the its return value 1 and if false then return 0.. here return 1.. that mean ultimately syntax is while 1; its also a infinite loop and give same value if you use while 1==1 if u use while 1; then it will give same output as above explanation.. hope you understand
1st Jun 2018, 6:17 PM
Scooby
Scooby - avatar
+ 1
Thank you for your answer.i know the while loop.l just want to know why the '1==' can be replaced by other infinite loops
1st Jun 2018, 5:44 PM
leekuy
0
Thank you very much.I have got it.Thank you again!
2nd Jun 2018, 12:25 AM
leekuy