Skip to Content
Blocks, Procs, and Lambdas
Passing Your Proc to a Method

Perfect! Now let’s pass our proc to a method.



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!

puts youngsters at the end of the file in order to see the final contents of the array.

Folder Icon

Take this course for free

Already have an account?