Introduction
Console input/output (IO) lets your program talk with the user. It helps you get information from the user and show results back.
Console input/output (IO) lets your program talk with the user. It helps you get information from the user and show results back.
Console.WriteLine("message");
string input = Console.ReadLine();Console.WriteLine prints text to the screen and moves to the next line.
Console.ReadLine waits for the user to type something and press Enter.
Console.WriteLine("Hello, world!");name.string name = Console.ReadLine();
Console.WriteLine("Enter your age:"); string age = Console.ReadLine(); Console.WriteLine($"You are {age} years old.");
This program asks the user for their favorite color and then repeats it back to them.
using System; class Program { static void Main() { Console.WriteLine("What is your favorite color?"); string color = Console.ReadLine(); Console.WriteLine($"Your favorite color is {color}!"); } }
Console IO is great for learning and simple programs but not for complex user interfaces.
Always guide the user with clear messages when asking for input.
Console IO helps programs interact with users by reading input and showing output.
It is useful for simple, quick, and text-based programs.
Console.WriteLine("Enter your name:");
string name = Console.ReadLine();
Console.WriteLine($"Hello, {name}!");Console.WriteLine("Enter a number:");
int num = Console.ReadLine();
Console.WriteLine($"Number is {num}");Pass the test and this pattern moves unknown