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#

if / else

Write code to print "C# Rocks!" to the console if language equals "C#".

1 Answer

I would like to see your code so I can see where you went wrong and give some help!

I was having the same problem, are you coping "C# Rocks!" as the script doesn't like this so try typing it out. If that wasn't the case then try this code.

Try this code

string language = Console.ReadLine(); // This will read what the user has entered

if(language == "C#") // If the language is same as c# then it will go into the curly braces

{ System.Console.WriteLine("C# Rocks!"); //It will write c# Rocks! to the console }