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) Perfect Validating Input

Aaron Coursolle
Aaron Coursolle
18,014 Points

Resolved: In last code challenge: An error in logic.

Hi, I noticed a small mistake in the code challenge question (it doesn't affect validating if the code is correct or not; it just might cause confusion). According to the chart, the code should print "Just right" instead of "Too cold!"

Original Challenge Wording: The following table describes my room temperature preferences. Print the message from the table when a user enters a number in the corresponding range. For example, if temperature is 21 the code should print "Too cold!" to the screen.

Temperature (deg C) -- Message; Less than 21 deg -- Too cold!; 21 deg to 22 deg -- Just right.; Greater than 22 deg -- Too hot!

3 Answers

Jeremy McLain
STAFF
Jeremy McLain
Treehouse Guest Teacher

Good catch Aaron! I fixed the wording.

Hi Aaron,

Very nice spot, I'd missed that one. I'll pass the feedback on to Jeremy McLain.

Tomasz Necek
PLUS
Tomasz Necek
Courses Plus Student 7,028 Points

Why I couldn't put : else if(temperature == 21||22) ?? There was a problem with " || " . Thanks.

Hi Tomasz,

temperature == 21||22 would actually read as (temperature == 21) OR (22).

Whereas I think you are meaning (temperature == 21) OR (temperature == 22)