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

Ruby

I don't understand why the while loop didn't stop the loop at 5.

When the loop was tested for 6, the loop printed 6 times. I thought the while loop was set up to stop at 5. Why did it not stop? The video does not do a very good job of explaining this.

Hi Keith,

Can you link to the video so we can review it? Or post the code you're referring to.

1 Answer

The only reason I can think of is if the internal function within the while loop just ran 6 times without looping back.