How to make console wait? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make console wait?

what code i can use to make console wait a few moments before runing rest of code? for example if i want to write "Hello world" for 5 seconds then clear the screen then write something else, what should i do?

12th Feb 2017, 8:39 PM
Eren Ceylan
Eren Ceylan - avatar
3 Answers
+ 7
Add this to the top of your code: using System.Threading; Then, where you want to pause, write Thread.Sleep(numMilliseconds); 1000 millis = 1 second of waiting. It won't work on the Code Playground with how it works, though. You'll have to run the code on a computer.
12th Feb 2017, 9:00 PM
Tamra
Tamra - avatar
0
thank you
12th Feb 2017, 9:13 PM
Eren Ceylan
Eren Ceylan - avatar
- 1
didn't mean that. edited question.
12th Feb 2017, 8:57 PM
Eren Ceylan
Eren Ceylan - avatar