Passing Your Lambda to a Method


Instruction: 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!

My code seems to be correct. What is wrong?

crew = {
  captain: "Picard",
  first_officer: "Riker",
  lt_cdr: "Data",
  lt: "Worf",
  ensign: "Ro",
  counselor: "Troi",
  chief_engineer: "LaForge",
  doctor: "Crusher"
# Add your code below!
first_half = lambda{|profession, name| name<"M"}
a_to_m = (&first_half)

8. Why Procs?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.