Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
229,788 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