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 trialTojo Alex
Courses Plus Student 13,331 PointsI don't know what i did wrong in the code challenge
This is the error that comes everytime: I entered bogus i expected bogus is not C# instead i got cheese is not C#
string language = Console.ReadLine();
if(language == "C#")
{
System.Console.WriteLine("C# Rocks!");
}
else{
if (language != "C#"){
System.Console.WriteLine("Cheese is not C#");
}
}
2 Answers
Steven Parker
231,269 PointsThe word "Cheese" was just an example, the code needs to show what was actually input to the "language" variable. The instructions give you the argument to use language + " is not C#."
Also, you don't need to perform another test, since the "else" code will only run if the language was not "C#".
Yu-Yang Hsiao
6,295 PointsHi~Maybe you can try the following codes.
string language = Console.ReadLine();
if (language == "C#")
{
System.Console.WriteLine("{0} Rocks!",language);
}
else
{
System.Console.WriteLine("{0} is not C#", language);
}
Steven Parker
231,269 PointsThat will work, but you're getting ahead of the course. At this point, the concept of placeholder substitution hasn't yet been introduced and simple concatenation is expected.
Tojo Alex
Courses Plus Student 13,331 Pointsthank you aswell
Tojo Alex
Courses Plus Student 13,331 PointsTojo Alex
Courses Plus Student 13,331 Pointsthanks