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 Introduction to Operators and Conditionals Review IF / ELSE

Arjun Parashar
PLUS
Arjun Parashar
Courses Plus Student 2,150 Points

I'm not able to figure out this question.

Please help me with the answer to this question.

variable_assignment.mm
bool hasBonus;
int powerPoints =3;
if ( hasBonus >= powerPoints ) {
  hasBonus = false;
}
else { hasBonus = true;
     }

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Arjun,

While the syntax of you code is correct, I feel you may have misread the instructions for the second task.

First, you didn't assign the correct value to powerPoints... you gave it 3, but the task specifically asks for it to be assigned 5.

Second, you are comparing hasBonus to powerPoints in the conditional, but the tasks asks explicitly for you to compare powerPoints to a hard-coded value of 3.

With this in mind, go back and give it another shot. Pay close attention to the instructions. Challenges are very picky and will only pass if you do exactly what is asked.

Keep Coding! :) :dizzy:

Arjun Parashar
Arjun Parashar
Courses Plus Student 2,150 Points

Thank you for your reply. I was able to solve it. :)