C# & .NET Framework Hello, C#!
💡
Exercise 2

👋 Hello, World! 10 XP Easy

Ctrl+Enter Run Ctrl+S Save

🎉 The Classic Hello World — Architect Edition!

Every programmer in history has started with "Hello, World!" — it's a tradition dating back to 1978 when Brian Kernighan wrote it in a C programming tutorial. Now it's your turn!

But we're not just going to print one line. A real architect announces their project and their vision. Let's learn how C# handles text output.

📢 Console.WriteLine vs Console.Write

C# gives you two megaphones for printing text:

  • Console.WriteLine("text") — prints text and then moves to a new line (like pressing Enter after speaking)
  • Console.Write("text") — prints text but stays on the same line (like continuing to talk without pausing)

Watch the difference:

// Using WriteLine — each on its own line: Console.WriteLine("Line 1"); Console.WriteLine("Line 2"); // Output: // Line 1 // Line 2 // Using Write — stays on same line: Console.Write("Hello "); Console.Write("World"); // Output: // Hello World

🧱 The Building Blocks of a C# Program

In the previous exercise, we cheated a little — we just wrote a single line. But a real C# program has structure, like a real building has a foundation. Here's the basic skeleton:

using System; // Import the toolbox class Program // The blueprint name { static void Main() // The front door — where execution starts { // Your code goes here! } }

Think of it like this:

  • using System; — You're grabbing your toolbox. The System namespace contains Console and many other essential tools.
  • class Program — Every C# program lives inside a class. It's like the blueprint folder for your building.
  • static void Main() — This is the entry point — the front door of your program. When you run your app, this is where execution begins.
  • { } — Curly braces define code blocks. Everything between them belongs together, like rooms inside a building.

📝 Key Rules to Remember

  • Every statement ends with a semicolon ; — forget it and C# will complain!
  • Strings (text) must be wrapped in double quotes "like this" — single quotes are for individual characters.
  • C# is case-sensitiveConsole is NOT the same as console.
  • Main must have a capital M — it's the official entry point name.
📋 Instructions
**Time to build your first complete C# program!** Inside the `Main()` method, print **two lines** using `Console.WriteLine()`: ``` Hello, World! Welcome to C#! ``` You need TWO separate `Console.WriteLine()` calls — one for each line. Remember: - Each `Console.WriteLine()` prints its text and moves to a new line - Use double quotes around each string - End each statement with a semicolon
Write two separate lines inside Main(): Console.WriteLine("Hello, World!"); Console.WriteLine("Welcome to C#!"); Make sure the text matches exactly, including punctuation!
main.py
Hi! I'm Rex 👋
Output
Ready. Press ▶ Run or Ctrl+Enter.