7. PROC syntax


#1



https://www.codecademy.com/courses/ruby-beginner-en-L3ZCI/1/2?curriculum_id=5059f8619189a5000201fbcb


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)


#2

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.


#3

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