条件を指定して検索
Top > Ruby [2.2.2] > select
p [1,2,3,4,5,6,7,8,9,0].select{ |val| val % 2 == 0 } # [2, 4, 6, 8, 0] p [1,2,3,4,5,6,7,8,9,0].select{ |val| val < 4 } # [1, 2, 3, 0]