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

string language = Console.ReadLine(); if(language==“C#”) { Console.WriteLine(“C# Rocks!”); } //NG

it seems right but do not work

CodeChallenge.cs
using System;
string language = Console.ReadLine();
if(language==C#”)
{
    Console.WriteLine(C# Rocks!);
}

1 Answer

using System isn't necessary for this challenge and is one of the reasons it fails. The second reason is the quotes you are using. Did you copy them from the challenge or are you using a phone? You'll want the straight quotes instead of curly quotes. You can tell when they are used by the syntax coloring in that the quotes and all the text between will be orange.

" Vs. “

string language = Console.ReadLine();
if(language=="C#")
{
    Console.WriteLine("C# Rocks!");
}

-----------------------------------

string language = Console.ReadLine();
if(language==C#“)
{
    Console.WriteLine(C# Rocks!);
}