check if any of collection's items satisfy given condition
Parameters
some? collection :integer :string :dictionary :object :inline :block :range
params :null :literal :block
condition :block :bytecode
Attributes
with |
:literal |
use given index |
Returns
Examples
copy
if some? [1 3 5 6 7] 'x [even? x]
-> print "at least one number is an even integer"
; at least one number is an even integer
copy
print some? 1..10 'x -> x > 9
; true
copy
print some? [4 6 8 10] 'x [prime? x]
; false
copy
print some? 1..10 [x y]-> 15 < x+y
; true
copy
print some? [2 4 6 9] 'x [prime? x]
; true
copy
print some?.with:'i ["three" "two" "one" "four" "five"] 'x -> i >= size x
; true
Related