CollectionSome

This function calls a given closure/function with every element in a given collection and returns true, if one of the closure calls returns true.

Returns: boolean

Usage

CollectionSome( collection, closure [, parallel [, maxThreads ] ] )

Arguments

Argument Description Default
collection
(object, required)

collection to iterate

closure
(function, required)

function/closure that implements the following constructor [function(... depends on the given collection ...):boolean].

parallel
(boolean, optional)

execute closures parallel

maxThreads
(number, optional)

maximum number of threads executed, ignored when argument "parallel" is set to false

20

Examples

people = [ { name = "Alice", age = 32 }, { name = "Bob", age = 29 }, { name = "Eve", age = 41 }];

dump(CollectionSome(people, function(p) { return p.age > 40; })); // true

// member function
dump(people.some(function(p) { return p.age < 20; })); // false

See also