Ruby Ruby Loops Ruby Loops The Ruby Loop

Simon Goldman
Simon Goldman
1,028 Points


cant figure out the first part on how to add those?

numbers = []

number = 0

loop do
  "number" + 1 = "numbers"
  if "numbers" = 3 

2 Answers

Amir Eskandari
Amir Eskandari
9,153 Points

Hi Simon,

You have a few things going on that are causing this challenge to fail - here are some hints to fix the issues:

1) In the challenge "number" and "numbers" are variables so you don't need to use quotation marks in your code.

2) Remember that "=" is an assignment operator, what you want to use for comparisons is "==".

3) Since "numbers" is an array you need to use a method to push values to it.

4) In the problem you need to see when the length of numbers is == 3. This is another method for the Array class.

I hope that helps!

Since "numbers" is the array, in your loop; you need to use push


Then add 1 to number

number + 1

In you "If" statement, you need to set a length limit to your array

if numbers.length >= 3

Make those changes, and it will pass