I am switching from Python to C# and I am having trouble with the ReadLine()
function. If I want to ask a user for input Python I did it like this:
x = int(input("Type any number: "))
In C# this becomes:
int x = Int32.Parse (Console.ReadLine());
But if I type this I get an error:
int x = Int32.Parse (Console.ReadLine("Type any number: "));
How do I ask the user to type something in C#?
Console.WriteLine()
and thenConsole.ReadLine()
– NorkConsole.Write("Type any number:");
orConsole.WriteLine
then you can do the read line – Zimmermann