0
How can I return "\" as text in the console?
Console.Write("\"); returns "Newline in constant" error. \ seems to be used to call a command. Hoe can i use it as text?
2 Answers
+ 8
1. Its like what adonis stated.
2. If you wanted to declare a \ as a variable(string) and use it in the console, you cant. A variable must begin with a letter or an underscore, and can only contain letters, number or underscore.
Even if you could, you would be using the wrong way, as the correct way should be
Console.WriteLine(\);
(No need for the inverted commas inside)
+ 2
You need to escape it with double "\\"
Console.Write("\\");