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 trialMUZ140953 Herbert Samuriwo
7,929 PointsWrite code to print “C# Rocks!” to the console if language equals “C#”.
i'm stuck help
8 Answers
Andrea Moulding
8,287 PointsI found that my error was coming from copy and pasting “C# Rocks!” The "" are stylized and the script program hates them!
Larry R
13,955 Pointsstring language = Console.ReadLine();
if(language == "C#")
{
System.Console.WriteLine("C# Rocks!");
}
MUZ140953 Herbert Samuriwo
7,929 PointsSagar mybe i'm making mistake send your explanation in code form mybe it helps
Sagar Bharadia
10,722 PointsAre you able to link me to the challenge which you are currently stuck on? If you are still stuck on it?
Michael Apps
4,907 PointsHello. Am I missing something here? The code that it inputs for you string language = Console.ReadLine(); does not have the namespace System in front of it. Because of that I figured the line it was asking me to write didn't require it either Console.WriteLine("C# Rocks!"); It was failing me because I didn't use 'System.Console.WriteLine.....', but then shouldn't it have failed on the ReadLine it put in for me as well?
MUZ140953 Herbert Samuriwo
7,929 Pointsi had solved it thanks for your assistance
Sagar Bharadia
10,722 PointsAwesome!
Sagar Bharadia
10,722 PointsTo print in c# I believe it is System.Console.WriteLine(""); Hope this helps! You can also use System.Console.Write(""); You put the text within the "".
MUZ140953 Herbert Samuriwo
7,929 Pointsits not working Sugar
Sagar Bharadia
10,722 PointsHerbert, if in the case you have declared that you are using system at the top of your code (Using System;) then all you would need to write it Console.WriteLine(""); Hope this helps!
Nicholas Johnson
12,945 PointsNicholas Johnson
12,945 PointsVery, very tricky! Thanks for the tip. This was tripping me up, too!