StructSome()
This function calls a closure/function on every element in a struct until one returns true.
If one of the closure calls it will return returns true, otherwise false
StructSome( struct=struct, closure=function, parallel=boolean, maxThreads=number );
Returns: Boolean
| Argument | Description | Default |
|---|---|---|
|
struct
struct,
required
|
edit
struct to iterate Alias: structure, object |
|
|
closure
function,
required
|
edit
function/closure that implements the following constructor
and returns a boolean value Alias: function, callback, udf |
|
|
parallel
boolean,
optional
|
edit
execute closures parallel |
|
|
maxThreads
number,
optional
|
edit
maximum number of threads executed, ignored when argument "parallel" is set to false Alias: maxThreadCount |
20 |
Examples
editst = {
1 : { active: true},
2 : { active: false},
3 : { active: false}
};
result = structSome(st, function(key,value){
dump(var=value, label=key);
return value.active;
});
dump (result);
See also
- Collections
- Structures
- struct.some()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)