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 trialShazad Kazi
10,758 PointsAt 5:29, shouldn't the code run 21 times as you are starting with 0 and going to 20 inclusive.
Questions sums it up.
I believe its an error that should be fixed.
2 Answers
Philip Gales
15,193 PointsThe code does run 21 times. Originally when he switches screens he has the old code that ran till 10. He then refreshes the page and you can see it update to show 0 to 20, which is 21 times. This always confuses me, and I have to think that if it was 0 through 2, then it ran 3 times (2 + 1), so 0 to 20 would be 21 times (20 + 1).
Adam Fournace
Courses Plus Student 4,115 PointsRuns / Index 1 == 0 2 == 1 3 == 2 4 == 3 5 == 4 6 == 5 7 == 6 8 == 7 9 == 8 10 == 9 11 == 10 12 == 11 13 == 12 14 == 13 15 == 14 16 == 15 17 == 16 18 == 17 19 == 18 20 == 19 21 == 20