Lesson 1: Console.WriteLine() — Show text on screen
The first step in any programming language is showing something. In C# the command Console.WriteLine() displays text on the screen and moves to a new line. Two conventions ride along from line one: text is written in double quotes "like this", and every command ends with a semicolon ;.
Console.WriteLine() is like a speaker that reads a sign and then moves down a line. Whatever you write inside the double quotes gets read onto the screen. The semicolon ; is the breath that says "this command is finished".
- Console.WriteLine()
- The command that displays text on the screen and then moves to a new line.
- Console.Write()
- Like WriteLine but without moving to a new line — the next output sticks right after it.
- string
- Text in code. In C# a string is wrapped in double quotes " ". Single quotes ' ' are reserved for a single character.
- semicolon ;
- The mark that tells C# a command has finished. Each such command (like Console.WriteLine) ends with it.