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 / else

Zeynal Zeynalov
Zeynal Zeynalov
281 Points

Can not understand what is my mistake

It always tells me that I entered "bogus" but it gave me "javais not C#" for example.

Could you please help me to understatnd my mistake

CodeChallenge.cs
string language = Console.ReadLine();


if (language == "C#")

{
Console.WriteLine("C# Rocks!");
}

else

{
 Console.WriteLine(language +  "is not C#");   
}

Could it be that you're missing a space in your else output?

Simon Coates
Simon Coates
28,692 Points

Simon McGuirk seems to be right (I verified). Just need to add a space in the output. However, the message I got when using your code seemed kinda messed up: 'I entered "bogus". I expected "bogus is not C#.", but got "pythonis not C#" instead.'

Steven Parker
Steven Parker
216,164 Points

Sounds like a bug in the error message. You might want to report it to Support.

2 Answers

Simon McGuirk
Simon McGuirk
2,673 Points

Actually got to this bit of the course. The requirements require the else output to display the language plus " is not C#." So you'll need to make sure that you add the space at the beginning of the string and full stop/period at the end " is not C#."

As for the issue the value being stored in language, this is being actioned by the test/code checker which I assume randomly assigns a different programming language to verify the else output.

Zeynal Zeynalov
Zeynal Zeynalov
281 Points

Dear Simon,

Thanks, the issue was that I had to put space prior to "is" expression.

So simple!)))

Thanks for your support guys!)))