21. Blocks, Procs, and Lambdas


#1

first_half = lambda {|k, n| n < "M"}

a_to_m = crew.select($first_half)

It keeps saying wrong number of arguments(1 for 0)
I don't understand what is wrong with the argument n < "M"


#2

replace the dollar ($) with (&), your code should work
a_to_m = crew.select(&first_half)


#3

ages = [23, 101, 7, 104, 11, 94, 100, 121, 101, 70, 44]

Add your code below!

under_100 = Proc.new do |number|
if(number<100)
puts "Less than 100"
else
puts "More than 100"
end
end

youngsters = ages.select(&under_100)

This is my code for the 19 chap of Blocks,Procs,Lambdas and it works fine but it still give the error that 23 is not included whereas it includes 23

Less than 100
More than 100
Less than 100
More than 100
Less than 100
Less than 100
More than 100
More than 100
More than 100
Less than 100
Less than 100

First output is less than.