Proc to method, who could help me out?


#1

my code:

ages = [23, 101, 7, 104, 11, 94, 100, 121, 101, 70, 44]

under_100 = Proc.new do
ages.each < 100
end

youngsters = ages.select(&under_100)

instuctions:
Now we'll be using the ages array. Create a variable
called youngsters and set it equal to calling .select on ages, and pass
in your under_100 proc to filter for the ages that are less than one
hundred. Remember to pass &under_100 to convert your proc to a
block!


#2

Your proc should not loop through anything or even be aware of your array. It should look at a single value and determine if it's less than 100.


#3

The desired result of the exercise is "to filter for the ages that are less than one hundred" so your block code should be like this : do |x| x < 100 end