Hello World!
Part of the Fundamentals section of Coddy's C# journey — lesson 2 of 69.
The "Hello World!" is a simple program that outputs Hello World! to the screen.
In C#, we use Console.WriteLine() to print output to the console. The text to be printed is placed within double quotes and enclosed in parentheses.
Every C# program starts from the Main() method — it is the entry point of the program. Your code goes inside Main().
Let's take a look at the "Hello World!" program in C#:
public class Program {
public static void Main(string[] args) {
Console.WriteLine("Hello World!");
}
}Challenge
BeginnerUse the code view to write a program that outputs Hello World!
Note that anything inside quotation marks is case sensitive. For example:
Console.WriteLine("Hello World!");Console.WriteLine("hello world!");are different things (notice the capital letters in the first line).
Cheat sheet
To print to the console in C# use Console.WriteLine():
public class Program {
public static void Main(string[] args) {
Console.WriteLine("Hello World!");
}
}Try it yourself
using System;
public class Program {
public static void Main(string[] args) {
// Write your code below
}
}This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
4Operators Part 1
Arithmetic OperatorsModulo OperatorIncrement/DecrementPost Increment/DecrementArithmetic Shortcuts5Operators Part 2
Comparison OperatorsLogical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3