Newbie Ruby question...
fighton (0)

Why is this code no returning the values over 5?

def bigger_filter(nums, target)

bigger = []

i = 0
while i < nums.length
if nums[i] > target
bigger << nums
end

i += 1
end

return bigger

end

p bigger_filter([7, 3, 2, 8, 12], 5)

You are viewing a single comment. View All
mwilki7 (203)

bigger << nums
does that need to be
bigger << nums[i] ?