7. PROC syntax



I am just curious if the code I have here is exceptional for ruby.. The code passed but for some reason I feel un-easy about it

 floats = [1.2, 3.45, 0.91, 7.727, 11.42, 482.911]
# Write your code below this line!
round_down=Proc.new {|x| x.floor}

# Write your code above this line!
ints = floats.collect(&round_down)


No, this is good.

You create a new proc. You single out x, which you then round down to the nearest integer.

Simple, to the point, correct answer.


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