Proc syntax


#1

i don't get it, what's the right answer??

floats = [1.2, 3.45, 0.91, 7.727, 11.42, 482.911]
round_down = proc.new { |float| float.floor }
ints = floats.collect(&round_down)

this was my code


#2

Hi here

proc.new

You should use uppercase P like that

Proc.new

#3

what a dumb mistake ! tnx


#4

I don't understand why 'float' references on line two are all singular and this syntax still works?
Am I missing something - how can that be?


#5

@hkdeven I think it's because it's just a stand in placeholder argument inside the block. So, in mine, I just used |x| and x.floor and it works. I'm still figuring this stuff out so I could be wrong, but that's my understanding of it.