enum.select { |obj| block } â array
enum.select â an_enumerator
enum.select â an_enumerator
Instance Public methods
Returns an array containing all elements of enum
for which the
given block
returns a true value.
If no block is given, an Enumerator is returned instead.
(1..10).find_all { |i| i % 3 == 0 } #=> [3, 6, 9] [1,2,3,4,5].select { |num| num.even? } #=> [2, 4]
See also #reject.
Please login to continue.