📖 Instructions#
The first thing we’ll do is greet the player. Right now, the program displays Hello, World!. The goal of this lesson is to replace that with a proper welcome message for the game.
To do that, you need to understand two things: what a string is, and how to print text to the console.
A string is a data type used to represent text. In most languages, strings are written between quotes:
"Welcome to Odds and Evens!"To display a string in the console, you pass it to a built-in function designed for console output:
Console.WriteLine("Welcome to Odds and Evens!");When the program runs this line, it executes the function and the text appears in the console.
🧠 Recall
🎓 Learn More
✅ What to Do#
Replace the Hello, World! message with a welcome message for the Odds and Evens game.
🎯 Expected Outcome#
Welcome to Odds and Evens!
💡 Hints#
Hint 1
Find the line in Program.cs that currently prints Hello, World!. That’s the only line you need to change.
Hint 2
Console.WriteLine displays whatever string you pass to it. Change the text inside the quotes.
⚠️ Common Mistakes#
Editing the wrong line
Program.cs currently has one line of code followed by comment lines. Make sure you’re editing the Console.WriteLine line at the top — not one of the comment lines below it.
Changing the text but keeping the wrong punctuation
The expected output is Welcome to Odds and Evens! — with a capital W, capital O, capital E, and an exclamation mark. Any difference in capitalisation or punctuation will produce output that doesn’t match.
Removing the quotes
The text must stay inside double quotes. Writing Console.WriteLine(Welcome to Odds and Evens!) without quotes is a compile error — the compiler will try to read the text as code, not as a string.
🙈 Solution#
Tried, you must, before reveal the solution you may.
Program.csChanges
- Console.WriteLine("Hello, World!");
+ Console.WriteLine("Welcome to Odds and Evens!");
Program.csFinal
Console.WriteLine("Welcome to Odds and Evens!");
// Player chooses to play with odds or evens.
// Player enters a number between 1 and 2.
// Computer randomly generates a number between 1 and 2.
// Add the two numbers.
// Check if the sum is odd or even.
// Decide the round winner.
// Repeat rounds until one of the players wins two times.
// Announce the game winner.
// Ask the player to play again or quit.