8. Why Procs?


#1

(ruby):14: syntax error, unexpected tAMPER
can_ride_1 = group_1.select (&over_4_feet)

that is the error message
^

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 do |height|
  height >= 4
end

# 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)

puts can_ride_1
puts can_ride_2
puts can_ride_3 



#2

problem solved, it shoud be

can_ride_1 = group_1.select(&over_4_feet)

without space after .select


#3

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