Question
So I am learning to code C# I have a question.
int x = 5;
while (x > 0) {
Console.Write(x);
x--;
if (x == 2) {
x = 5;
}
}
why would this equal
543543543543543543
opposed to
55555555555555555555555555555
I thought it would be "5555555555" as the console is writing before it minuses the integer6 Replies
Sure, but after it's written 5, what happens then?
oh it loops back round
duh
sorry it was a stupid question, i just didnt look properly lol
debugging line by line would also help
to see the code flow
yeah
i understand it fully now, i think i just confused myself
thank you x
Cool, glad to hear!
$close
If you have no further questions, please use /close to mark the forum thread as answered