Created
December 30, 2014 04:20
-
-
Save anonymous/ab120f19adb7014da68d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here at the amusement park, you have to be four feet tall | |
# or taller to ride the roller coaster. Let's use .select on | |
# each group to get only the ones four feet tall or taller. | |
group_1 = [4.1, 5.5, 3.2, 3.3, 6.1, 3.9, 4.7] | |
group_2 = [7.0, 3.8, 6.2, 6.1, 4.4, 4.9, 3.0] | |
group_3 = [5.5, 5.1, 3.9, 4.3, 4.9, 3.2, 3.2] | |
# Complete this as a new Proc | |
over_4_feet = Proc.new { |height| height >= 4 } | |
# Change these three so that they use your new over_4_feet Proc | |
can_ride_1 = group_1.select {&over_4_feet} | |
can_ride_2 = group_2.select {&over_4_feet} | |
can_ride_3 = group_3.select {&over_4_feet} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment