0
C# error in continue and break question 1
Heres the question: for(int x = 1; x <= 8; x++){ If(x > 5) break; } what will x be? (Answer is 5????) If x = 5 X is not larger or small than 5 because x is five Therefore when x is five it should not be breaking the loop
3 Answers
+ 1
You are right. When x is 5 it does not break the loop because 5 > 5 returns false. x gets 6 and now 6 > 5 returns true. So the loop breaks when x gets 6.
+ 1
the issue is that people learning c# may use those operators incorrectly if the place they are learning it from has them wrong