C# C# Basics Perform if / else

Travis Williams
Travis Williams
489 Points

I dont understand why the else statement wont work

I made sure i included the System namespace

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

if(language == "C#")
{
  System.Console.WriteLine("C# Rocks!");
}
else
{
    System.Console.WriteLine(language + "is not C#.");
}

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 135,834 Points

HI Travis,

Your syntax is correct, but remember the spacing when concatenating strings. Right now if someone entered "Cheese", your string would return Cheeseis not C#.

Just fix up that missing space and the rest is good.

Nice Work! :) :dizzy: