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

iOS Objective-C Basics More Operators! Logical Operators

Bernard Chan
Bernard Chan
36,471 Points

What is the correct answer?

I don't understand where I get wrong?

variable_assignment.mm
bool isMediumSize;
int inchesTall = 64;

if(48 < inchesTall && inchesTall < 68) {
  isMediumSize = true;
}

1 Answer

Hi Bernard,

It looks as though the compiler doesn't like the order in which you've compared to 48. This code works:

bool isMediumSize;
int inchesTall = 64;
if(inchesTall < 68 && inchesTall > 48){
  isMediumSize = true;
}

But if you compare using 48 (is less than) inchesTall, as you have done, the challenge fails. I'm trying to think of a reason why ...

Steve.

P.S. Using the greater than and less than symbols outside of code blocks in this forum causes odd things to happen to your post, hence why I typed (is less than)!