+ 1
Why it prints 3 times instead of 4? I thought it will print 5, 4, 3, 2 so it's 4 times, right? Can someone explain it to me? Thanks
4 odpowiedzi
+ 1
Because the condition says i<=2 so 2 isn't a output.
+ 1
2<=2, Isn't it right?
+ 1
I forgot to say that the condition have the "break", so that evade the "print"
0
Because we decrement i just before evaluating it, so inmediatly after reaching 2 we enter the if and break the loop