code register log in programs messages download about privacy terms french production
home / documentation / Range / any?
Range
examples
any with true block
input
(0..10).any? { true }
result
true
any with false block
input
(0..10).any? { false }
result
false
any with even method
input
(0..10).any?(&:even?)
result
true
any with block checking if elements are even
input
(0..10).any? { |element| element.even? }
result
true
any with index check
input
(0..10).any? { |element, index| index.zero? || index.positive? }
result
true
any with range check
input
(0..10).any? { |element, index, range| range.first.zero? }
result
true