Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Basics (Retired) Perform if

What am i missing?

What am i missing here'?

CodeChallenge.cs
string language = Console.ReadLine();
if (launguage == "C#");
{
    console.WriteLine("C# Rocks!");
}

1 Answer

andren
andren
28,503 Points

Your code is close, but there are three issues:

  1. You have misspelled language as launguage in your if statement.
  2. You have a semicolon after the condition of your if statement, which causes the if statement to be terminated right away.
  3. You have written console instead of Console inside of the if statement. Since C# is case-sensitive it does not consider those two words to be the same thing.

If you fix all of those issues like this:

string language = Console.ReadLine();
if (language == "C#") // launguage replaced with language and removed semicolon
{
    Console.WriteLine("C# Rocks!"); // console replaced with Console
}

Then your code will work.