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 trialAmber Hoddinott
6,494 Pointsdoesnt the do while loop need to be less then or equal to 10 to run 10 times?
?
2 Answers
Colin Marshall
32,861 PointsThe counter starts at 0 and doesn't get incremented until the end of the loop. If it is set to less than or equal to 10, it will print it out 11 times because the loop runs for 0-10, which is 11 values.
pi R
12,720 PointsNope, because the do..while loop execute the code once before evaluating the condition ! So if you put equal to 10, it will run 11 times.