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.

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