find_all with block logic : find_all « Array « Ruby






find_all with block logic


a = ["a", "b", "c", "d", "e", "f", "g", "h"]
p a.find_all { |x| x < "e" }       # => ["a", "b", "c", "d"]

 

Related examples in the same category