2. Collect'Em All [Solved]


#1

fibs = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]

Add your code below!

doubled_fibs = [fibs.collect {|num| num * 2 }]

Code above gives error:

Oops, try again. The doubled_fibs array should include 2, but doesn't!

BUT IT DOES. What am I doing wrong?


#2

You're putting the result of your fibs.collect inside an array. collect already returns an array, you don't need an additional array.


#3

Thanks. So silly of me :blush: