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) Perfect if / else if / else

getting an error "Unexpected symbol `System' "

I've been staring at my code for longer than i'd like to admit trying to figure out what is wrong. for some reason it looks like it doesn't like my using statement. any advice?

CodeChallenge.cs
using System;
string input = Console.ReadLine();
int temperature = int.Parse(input);

    if(temperature < 21){
         Consol.Writeline("Too cold!");
    }
    else if (temperature >= 21 ||temperature <= 22 )
    {
       Consol.WriteLine("Just right.");
    }
    else 
    {
       Console.WriteLine("Too hot!");
    }

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! First, and foremost, the reason that you're getting that error is because they've included the System for you. But, even if we remove the first line there your code will still fail. Your first WriteLine is misspelled. You have "Writeline" instead. The first two Console are misspelled. After changing those, you still have a logic flaw. If I were to send in the temperature of 90 right now, your code will print out "Just right". The second else if says that if the temperature is greater than or equal to 21 or less than or equal to 22 print out "Just right". 90 is greater than or equal to 21. Remember, if we use OR only one has to be true for the code to run. Try again with these tips in mind! Happy coding! :sparkles:

wow intellisense in visual studio has spoiled me. Thanks!

Cindy Lea
PLUS
Cindy Lea
Courses Plus Student 6,497 Points

maybe its looking for a particular package, not just system?