check if every item in collection satisfies given condition
Parameters
every? 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 every? [2 4 6 8] 'x [even? x]
-> print "every number is an even integer"
; every number is an even integer
copy
print every? 1..10 'x -> x < 11
; true
copy
print every? 1..10 [x y]-> 20 > x+y
; true
copy
print every? [2 3 5 7 11 14] 'x [prime? x]
; false
copy
print every?.with:'i ["one" "two" "three"] 'x -> 4 > (size x)-i
; true
Related