Accepting User Input � The most important part of programming is accepting user input and manipulating the data that they provide. To demonstrate I will show you how to create a simple program which asks the user for there name and then will output "Hello, [name]." � Here is the code to do this: � string name = ""; Console.WriteLine("What is your name?"); name = Console.ReadLine(); Console.WriteLine("Hello, " + name); Console.ReadLine(); � � This incorporates everything we've learned so far with one new addition. � name = Console.ReadLine(); � This is quite self explanatory all it does is take whatever the user types and places it in the variable name. Then all we do is output it with the normal Console.WriteLine. � � � So now you have all you need to start making some basic programs involving variables. user input, basic calculations and outputing data. Look out for further tutorials that will continue into if statements, loops and arrays. |