Why do you write the line: yourName = Console.ReadLine();? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why do you write the line: yourName = Console.ReadLine();?

1st Dec 2016, 5:17 PM
Bryan De Costa
Bryan De Costa - avatar
1 Answer
+ 1
The 'Console.ReadLine(); ' means the program will read a line of text the user types. 'yourName' stores what the program read. It doesn't have to say YourName though. You can declare any string variable. String yourname creates the variable, but you can use 'String DuckFart' and type in DuckFart instead of yourName. 'Console.WriteLine(yourName);' will display whatever text was stored in the 'yourName' variable. Example: if user types 'Bob' (program reads what user typed and stored data in yourName) Output of WriteLine will be 'Bob' (program writes what is in yourName on screen)
1st Dec 2016, 5:36 PM
Dale Allen Burns Jr.
Dale Allen Burns Jr. - avatar