Camp 1 · Step 2 of 12
Hello, .NET!
Run modern C#, print with WriteLine, and use interpolation — the friendly front door.
Modern C# lets you start with almost no ceremony. Let's write real programs from line one.
Printing
Console.WriteLine(...)— print with a newlineConsole.Write(...)— print without oneConsoleis C#'s gateway to the terminal, from the .NET library
String interpolation
Prefix a string with $ and embed expressions in { }:
The same idea you've seen across this trail — Python's f-strings, Swift's
\(...), C#'s $"...{...}". Modern languages converged on the same good
idea.
Where's the class and Main?
Traditional C# wraps everything in a class and a Main method:
class Program {
static void Main() {
Console.WriteLine("Hello");
}
}Top-level statements (modern C#) let you skip that boilerplate for simple programs — the compiler adds it invisibly. You'll meet classes properly in Camp 4; for now, enjoy the clean start.
What's the difference between Console.WriteLine and Console.Write?
In $"Total: {a + b}", what does {a + b} do?
What's next
Variables and types — C#'s strong, friendly type system.