Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Output · Lesson 15 of 27

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

🤖
Time to make C# actually say something out loud. 🔊

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!");
    }
}
This complete program outputs exactly one line: Hello, World!
🤖
That "Line" at the end is doing more work than you would guess. 📏

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 line
Two WriteLine() calls produce two separate lines.
Fill in the blank

Console.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!
Without "using System;", you would have to write out System.Console.WriteLine() in full every time, as the first line shows.
Quick check

What happens right after Console.WriteLine("Hi"); outputs its text?

🤖
Miss the quotation marks here and the compiler gets very confused. ⚠️

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.

True or false

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 →