Bug in "8. Why Procs?" Allows progress unintentionally


#1




It accepted the following code even though I needed to still replace the .select blocks with the proc "over_4_feet"



# 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 {|x| x > 4}

# Change these three so that they use your new over_4_feet Proc
can_ride_1 = group_1.select { |height| height >= 4 }
can_ride_2 = group_2.select { |height| height >= 4 }
can_ride_3 = group_3.select { |height| height >= 4 }


#2

The SCT may be content to find that you completed this line, and the author may have thought it unnecessary to see if we followed through with the remaining instructions. Guess it's up to us to see how things work.


#3

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