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
barrycarter (12)

My standard advice for debugging: add print statements everywhere and see where bigger gets and loses its value.