0

This code does not work why?

int me = 1; for (me <= 80) { me++; Console.Write(me); Console.Write("one year has passed"); } if (me == 81) { Console.Write("you have died"); }

25th Oct 2022, 12:18 AM
Kruz Raleigh
4 Answers
+ 2
Kruz Raleigh check the syntax of the for loop. Even though you are not using the initialize and the update portions of the syntax, you still need to include the separating semicolons.
25th Oct 2022, 2:10 AM
Brian
Brian - avatar
+ 1
Side comment: wouldn't this suit better a while loop?
25th Oct 2022, 2:19 AM
Emerson Prado
Emerson Prado - avatar
+ 1
Ok, thanks I’ll use this information.
25th Oct 2022, 12:40 PM
Kruz Raleigh
0
Idk, I don't use the c# yet. But I think you are getting somewhere. Don't know why it don't work
25th Oct 2022, 1:16 AM
A Cooler Refrigerator
A Cooler Refrigerator - avatar