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

mark hengstebeck
mark hengstebeck
1,119 Points

Why isn't my computer understanding this human in this task of true or false?

} bool hasBonus; int powerPoints; powerPoints = 5; if (powerPoints < 3) { hasBonus = false; }

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

    else{
        powerPoints >= 3;
      hasBonus = true;
    }

2 Answers

Kirill Koleno
seal-mask
.a{fill-rule:evenodd;}techdegree
Kirill Koleno
iOS Development with Swift Techdegree Student 15,327 Points

bool hasBonus; int powerPoints = 5;

if (powerPoints < 3) { hasBonus = FALSE; } else { hasBonus = TRUE; }

Challenge Task 2 of 2

Change the value of powerPoints to 5. Then create an if else statement such that when 'powerPoints' is less than 3 'hasBonus' is false, but in all other cases 'hasBonus' is true.

Check the variable need to make only 1 time when you starts loop&

powerPoints >= 3; - it's too much

PS: I am sorry for my bad english ^_^

mark hengstebeck
mark hengstebeck
1,119 Points

Hi Krill,

Thanks for your help. I wrote it down, and when I went back to Xcode to correct my version, I discovered that I had already figured it out and it was written just as you had specified.

Thank you, Mark