Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!);
}