0

Issue with C# "Getting User Input"

Hi everyone, there is an issue with this code excersise as I have tried running it by the following: string yourName; Console.WriteLine("What is your name?"); yourName = Console.ReadLine(); Console.WriteLine("Hello {0}, yourName"); What happens is that it just prints out "Hello {0}" and not the variable yourname where {0} is. I'm not sure what is wrong but help would be grateful. There is also an error with the following code: int age = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("You are {0} years old, age");

4th May 2020, 5:21 PM
PocketPixie
1 Antwort