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 Ruby Loops Ruby Loops The Ruby Loop

Shunji Lin
Shunji Lin
12,896 Points

Is there a problem with this question?

Q: Using the loop construct, add the current value of number to the numbers array. Inside of the loop, add 1 to the number variable. If the numbers array has more than 3 items, use the break keyword to exit the loop.

numbers = [] number = 0

Sorry to be picky, but it seems that in order to answer this question correctly, the final output of your numbers array has to have 3 items, but the question clearly states that your array should have more than 3 items, i.e. 4.

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

You are right, it only passed when I included this condition:

break if numbers.length >= 3

And it's weird, because I'm almost sure the question was different a few weeks back when I was doing this course and there was no problem like this. Please contact the support (link on the right), link them the challenge and explain the problem, they should correct this shortly.

Good catch.