Why output this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why output this code?

int x = 10; for ( ; ; ) { if (x>0) { Console.WriteLine(x); x -= 3; }else break; this code output 10 7 4 1 but int x = 10; for ( ; ; ) { if (x>0) { Console.WriteLine(x); x -= 3; }} this code output anything loop is infinite but why output anything? i think this code output: 10 7 4 1 ( for statement loops continue

12th Jun 2017, 10:53 PM
ģœ¤ģ„ģ§„
ģœ¤ģ„ģ§„ - avatar
1 Answer
+ 1
I guess that'sā€‹ because your program runs on a server and the server is waiting for your program to finish before to send you the result.
12th Jun 2017, 11:58 PM
Mihai Manole
Mihai Manole - avatar