FAQ: Blocks, Procs, and Lambdas - Passing Your Lambda to a Method

This community-built FAQ covers the “Passing Your Lambda to a Method” exercise from the lesson “Blocks, Procs, and Lambdas”.

Paths and Courses
This exercise can be found in the following Codecademy content:

FAQs on the exercise Passing Your Lambda to a Method

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Agree with a comment or answer? Like () to up-vote the contribution!

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hi,
this is how I resolved it. Just following the instruction

a_to_m = crew.select(&first_half)

first_half = lambda { |x,y| y < “M”}

puts a_to_m

I hope it can be helpful

I tried your code in replit.com, @marcopalumbo35989018 , but the order of the first two lines stopped it running properly. Switching their places worked fine.

Hi everyone!

With a lot of these exercises I manage to pass them, but I struggle to put into plain terms what the code is doing.

Am I correct in saying something like this for line 13: Filter the crew hash using the first_half lambda and store those values in the a_to_m variable?

Thanks.

In case breaking it down further helps:

Calling the `select` method on the `crew` hash.

Passing the `first_half` lambda as a block to filter out names `< 'M'`.

Storing the filtered results in the `a_to_m` variable as an array.