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

Home stretch! Now let’s pass our lambda to a method, as well.



To finish up, let’s go ahead and create a variable called a_to_m and set it equal to calling .select on crew, and pass in your first_half lambda to filter for the names that are before “M” in the alphabet. Remember to pass &first_half to convert your lambda to a block!

puts a_to_m 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?