C# C# Basics (Retired) Perform if / else

if

can you help correct my code

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

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

2 Answers

Robert Silva
Robert Silva
6,450 Points

No curly braces for your else clause and I am pretty sure you're missing a "." after "C#"... Try This:

string language = Console.ReadLine();

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

Michael Clark
Michael Clark
16,324 Points

You may just need a space in the concatenated string i.e language + " is not C#"