Mega Code Archive

 
Categories / Ruby / Array
 

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"]