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 trialSamuel Mengistu
Front End Web Development Techdegree Graduate 17,790 Pointswhile loop quiz. Can't figure out the answer to this quiz.
Okay, so we have a code version of a carnival based Dunk Tank. Please fill in the blanks with proper code for the while loop.
while (remainingTries_______ 0 ________ ________ dunkTank.isDunked()) { throwBall(); }
Could someone please help me solve this.
2 Answers
Chase Marchione
155,055 PointsThe logic is that there are still tries remaining, and the ball hasn't been dunked yet. Therefore, the throwBall method should be called.
while (remainingTries > 0 && !dunkTank.isDunked()) { throwBall(); }
Hope this helps!
Andrea Miotto
iOS Development Techdegree Graduate 23,357 PointsI was getting mad 'cos i was writing:
while (remainingTries != 0 && !dunkTank.isDunked()) { throwBall(); }
Samuel Mengistu
Front End Web Development Techdegree Graduate 17,790 PointsSamuel Mengistu
Front End Web Development Techdegree Graduate 17,790 PointsThanks a ton, this does help!