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

Michael Foster
Michael Foster
2,602 Points

"Bummer! Try again!"

This code challenge needs improvement.

The test automatically enters in "bogus" instead of "C#" and then quits when no loop is used(Despite correctly displaying the configured error message!). The challenge mentions nothing on how it expects to handle incorrect user input, then fails.

So I used a loop as is presumably intended. Now I just get the error "Bummer! Try again!" with no additional details. What gives?

CodeChallenge.cs
Console.WriteLine("Which language is the best?");
bool keepGoing = true;
while(keepGoing)
{
    string language = Console.ReadLine();
    if (language == "C#")
    {
        keepGoing = true;                      
    }
    else
    {
        Console.WriteLine("That's not what we want to hear! Try again!");
    }
}
Console.WriteLine("C# Rocks!");

1 Answer

Steven Parker
Steven Parker
231,248 Points

No, this challenge does not need (or accept) a loop.

And you don't need to print anything if the input is something other than "C#".

Just keep things simple, do only what the challenge asks and nothing else and you should pass easily.