computer4kids is now ComputerLeap. Same free lessons, same team. Read why we changed our name

← All lessons · 🧑‍💻 Coding Academy

👋

🎓

⏱ 25 min

Free

Hello, C#!

Meet C# and .NET, and write your first console program.

🎯 What you will learn

  • Where C# is used (Unity, apps, web)
  • Write a console program
  • Print with Console.WriteLine

👋 Let’s get started!

C# (say “C sharp”) powers Unity — the engine behind thousands of games 🎮 — plus Windows apps and websites. Modern C# lets you start with just one line!

🪜 Step by step

1. 🎮 Why C#?

C# runs on .NET, a free platform by Microsoft that works on Windows, Mac and Linux. Unity uses C# for game scripts.

2. ✍️ Top-level statements

In modern C#, a whole program can be a single line.

Console.WriteLine("Hello, C#!");
3. 🏠 The classic structure

Bigger programs use namespaces, classes and a Main method — like Java.

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello from Main!");
    }
}

🧪 Try it!

Read the code, guess what it prints, then press 👀 Show output.

My first C# program

Console.WriteLine("Hello, C#! 🎮");
Console.WriteLine("Let the quest begin...");
Console.Write("No new line ");
Console.WriteLine("then a new line.");

Classic program structure

class Program
{
    static void Main()
    {
        Console.WriteLine("Ready!");
    }
}

📖 Key words

Tap a card to flip it over!

C#
A modern language by Microsoft 🎮
.NET
The free platform that runs C# ⚙️
Console
The text window your program prints to 🖥️
WriteLine
Prints text and a new line 🖨️

🏆 Challenge

Set up: ask a grown-up to install the free .NET SDK and VS Code, then run dotnet new console. Predict this output first:

Challenge

Console.WriteLine("Level 1");
Console.WriteLine("Level 2");
Console.WriteLine("Boss level! 👾");

Knowledge Check Quiz

  1. Which game engine uses C#?
  2. What does Console.WriteLine do?
  3. What ends a C# statement?