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 Practicing with Immersive Examples Immersive Examples Code Challenge

Luis Paulino
Luis Paulino
Courses Plus Student 1,779 Points

Please help!!!!

I don't know what my Syntax error is?

bool levelFinished;
int rubies=0;
int rubyReward=7;
int rubyMax=50;


1 Answer

Hannah Gaskins
Hannah Gaskins
14,572 Points

Hey Luis,

It could be the way you have the the rubies increasing and it also could be the way you have the bool assigned at the end.

I used more literal syntax with my increasing rubies during the while loop and used YES instead of true which is an Objective-C thing. Here is what worked for my code:

BOOL levelFinished;
int rubies = 0;

int rubyReward = 7;
int rubyMax = 50;

while(rubies < rubyMax) {
  rubies = rubies + rubyReward;
levelFinished = YES;

With regard to the actual code, I think yours is correct but the treehouse compiler (especially with Gabe's videos) is very strict. I had to try a few times to get it to work for me as well :)

Hope this helps!