Console.Clear(); not Working in C#? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Console.Clear(); not Working in C#?

Whenever I put the Console.Clear(); method inside a statement it never works. For example, if I put Console.Clear(); inside a while loop, it doesn't clear the console. Can someone explain to me why this happens, and possibly tell me a solution to this problem? Thanks in advanced.

7th Mar 2020, 10:25 PM
Cipher
Cipher - avatar
2 Answers
+ 1
First, are you using an ide or the code playground? Second, what comes before and after the clear? Maybe you're just rewriting the text so it looks the same?
7th Mar 2020, 10:27 PM
coddy
coddy - avatar
0
Firstly, atm I code on my phone using an app called Dcoder since I don't have a working pc. Secondly, earlier I made a while loop that wrote a variable value to the console, then (it was supposed to) clear the console with Console.Clear(); then increment the variable. This isn't the first time I've encountered this Coder's Crux. double num = 1; while(true) { Console.WriteLine(num); Console.Clear(); num += 1; }
7th Mar 2020, 10:34 PM
Cipher
Cipher - avatar