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 / 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,694 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
231,248 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!)))