0
How can it be infinite if there stayed while 1 == 1: Because after first time "i" would be 2 and it's not any more while true: ?
i = 0 while 1==1: print(i) i = i + 1 if i >= 5: print("Breaking") break print("Finished") I understand, that it continues 4 time til it breaks. But the meaning of 1 == 1 is not clear. Thanks.
4 Antworten
+ 1
1 == 1 means that if one is one ore the same if you mean that
+ 1
You have to write i==1 instead of 1==1.
1 is always equal to 1😂
P.S. there would be no output
+ 1
Yep, 0 is the value of i at the beginning. On every loop iteration, it increases 1(or other)
Only while without condition is not following syntax of while loop. i==1 or other condition should be there (and to be checked on every iteration)
0
I know "while" will continue until a break. So why we don't just write "While" without 1== 1 or i == 1 ?
And what's the meaning of i = 0
Does it mean, that 0 is the value of i at the begin?