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 trialLinus Hallberg
845 Pointsit says task1 is no longer passing?
what am i doing wrong?
bool hasBonus;
int powerPoints=5;
if (powerPoints > 3) {
hasBonus = false;
} else {
hasBonus = true;
}
Tyler Andal
8,383 PointsTyler Andal
8,383 PointsYou'll need to declare hasBonus, and powerPoints as a variable, or constant before you provide the output type of bool, or int. Is this question tied to a particular lesson, or just a general question? If I was clear on the expected result I might be able to assist more clearly.
Below, is a spin off what you made above. It might be something you could use as a guide or template to help solve your issue. If you copy the content below in a playground you'll see how the print values change when the powerPoints variable is modified from 6 to another number.
var powerPoints = 6
if powerPoints > 3 { print("True: (powerPoints) is greater than 3") } else { print("False: (powerPoints) is less than 3") }
I hope this helps.