0
Please somebody explain some simple code
I have while loop with break after it gets 4, but in output I have 2 times 4 instead of 1, why ? https://code.sololearn.com/cTgGRr44AmIO/?ref=app
3 Réponses
0
while you are in the x==3 loop you increase it to 4 and output it (line 11: first "4"), then it loops again and outputs it again (line 6: second "4") then you are stopping the loop
+ 1
thank you very much: )
0
because you increment x before printing it will print 3 then 4 in the same loop then at the start of the next loop print 4 then break from loop.