21. Passing Your Lambda to a Method


#1

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{|x, y| y < "M"}
a_to_m = crew.select(&first_half)

I passed the lesson but I seem to be getting this result
wrong number of arguments (0 for 1)

Any errors?


#2

@devninja29661,
I tried you code in a windows 8.1 IE11 environment
and got a pass....
Maybe a reset Browser will help....

++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom