Creating a Lambda


#1

I made it this way, only that it does not display anything

first_half = lambda do |t,n| n <"M"
end

Next code is not requiere by exercise, but allows coder to see displays from m backwards.
n = crew.select(&first_half)


#2

But you're not asking to display anything in this code.


#3

yep, check this: n = crew.select(&first_half)


#4

That's not a display, that's an assignation. Ruby will show it to you because it's the last expression of the program, but it's not part of the output.

What's the exercise? Do they ask explicitly for output (print or puts) or not?


#5

Oh, you have opened two threads, you should delete this one then.


#6

Well, just use the single quotation mark and that should resolve it.

Just like this:

first_half = lambda { |x,y| y <'M'}

or

first_half = lambda do |x,v| v <'M' end


#7

An assignation is a tryst. The better term to use is assignment. Just for semantics.

This is the lesson with the same title as this topic:

https://www.codecademy.com/courses/ruby-beginner-en-L3ZCI/3/4