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 trialAaron Maguire
4,645 PointsAny help on finishing this code? Not sure where to go next.
Any suggestions? Thanks
bool levelFinished;
int rubies = 0;
int rubyReward = 7;
int rubyMax = 50;
while (rubies < rubyMax)
rubie
1 Answer
Dan Lindsay
39,611 PointsHey Aaron,
First, create the while loop:
while (rubies < rubyMax) {
}
then increment rubies by the rubyReward:
while (rubies < rubyMax) {
rubies += rubyReward;
}
and all that's left is to assign true to our levelFinished variable:
bool levelFinished;
int rubies = 0;
int rubyReward = 7;
int rubyMax = 50;
while (rubies < rubyMax) {
rubies += rubyReward;
levelFinished = TRUE; // this could also be levelFinished = YES;
}
With all this, you are good to go!