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,665 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
177,536 Points

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

2 Answers

Simon McGuirk
Simon McGuirk
1,574 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!)))