+ 5

I tried doing exactly what is in the tutorial but it exit right after.

exit

19th Nov 2016, 1:41 PM
Kate Verzonilla
Kate Verzonilla - avatar
7 Answers
+ 4
That's because the body of your code comes to an ending, if you are using Visual Studio, as soon as all your code is compiled it will close the application. In order to avoid that, simply add an Console.ReadKey(); to the end of your code scope, it will remain till you press a key to close it.
19th Nov 2016, 5:06 PM
Camila Dos Santos
Camila Dos Santos - avatar
+ 1
hey... write.. console.readkey in the end... it will keep the console window open
20th Dec 2016, 4:59 PM
Manish Dhakeria
Manish Dhakeria - avatar
+ 1
If you are using visual studio. You can run your program without debugging to prevent from closing. Just press control + f5 to test your program 😄
9th Jul 2017, 3:15 AM
Jasper Diongco
Jasper Diongco - avatar
0
Or run it without debugging. it will leave the window open after the code has finished.
9th Dec 2016, 9:00 PM
austin