enumerate

calculate the number of given collection's items that satisfy condition


Parameters

enumerate collection :integer :string :dictionary :object :inline :block :range
          params :null :literal :block
          condition :block :bytecode

Attributes

with :literal use given index

Returns

  • :integer

Examples

copy
enumerate 1..10000000 => odd? ; => 5000000

copy
enumerate.with:'i ["one" "two" "three" "four"] 'x -> i < 3 ; => 3

Related