Console I/O
Learn to format console output, utilize string interpolation, and safely process user input using conversion methods and the TryParse pattern.
We have already written several statements that print to the console. This lesson provides examples to consolidate that knowledge.
Console output
Two primary methods handle console output:
The
Console.Write()method prints to the console and keeps the cursor on the same line.The
Console.WriteLine()method prints to the console and moves the cursor to the next line.
Let’s review the following code snippets to see the difference.