Console.WriteLine()
A free lesson from Swipe Coding · C#, level 2 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
To display text on the screen (the "console") in C#, you use the command Console.WriteLine(). It outputs whatever text you pass to it in parentheses and double quotation marks.
using System;
class Program
{
static void Main()
{
Console.WriteLine("Hello, World!");
}
}The word "Line" in WriteLine tells you exactly what happens after the output: the cursor automatically moves down to a new line. So the next piece of output begins below it, not right after it.
Console.WriteLine("First line");
Console.WriteLine("Second line");
// Output:
// First line
// Second lineConsole.WriteLine() outputs text and then automatically moves to a new ____.
Console is a class that lives in the System namespace, which is why your file starts with "using System;" — that line tells the compiler where to find Console. WriteLine is the name of the method you are calling on it. The text in parentheses and double quotes is a "string" — exactly what gets printed to the screen.
System.Console.WriteLine("I am learning C#.");
Console.WriteLine("This is fun!");
// Output:
// I am learning C#.
// This is fun!What happens right after Console.WriteLine("Hi"); outputs its text?
Important: the text you want WriteLine() to output must sit inside double quotation marks, for example "Hello". Without them, the compiler would try to interpret the text as program code — like a variable or keyword — rather than as plain text, and your program would fail to compile.
Console.WriteLine() outputs text without any line break, exactly like Console.Write().
Keep your streak going in Swipe Coding
Swipe through every level of C# on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.
Get the Swipe apps →