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

Stuck and need a little help

Stuck on this, it tells me that if bogus is entered it would still return (I am aware it says testing)

CodeChallenge.cs
string language = Console.ReadLine();
if (language == "C#");
{
    Console.WriteLine("testing");
}
else 

1 Answer

Steven Parker
Steven Parker
210,443 Points

The instructions say, "Write code to print “C# Rocks!” to the console if language equals “C#”."

As it is now, the only message you'll get is "Bummer: Your code could not be compiled.". There are a few issues:

  • there should not be a semicolon between the "if" statement and the code block
  • the WriteLine contains the wrong message
  • an "else" must be followed by a statement or code block (but you don't need it for this challenge)

It was the semi colon, thanks