BoxSetEach
Invoke a callback for every element of a Set.
The callback receives the element value, its 1-based ordinal position, and the Set itself; single-argument callbacks receive only the value. Iteration follows the natural order of the underlying variant. Use setMap() if you need a transformed result.
Method Signature
BoxSetEach(set=[set], callback=[function:Consumer])Arguments
Argument
Type
Required
Description
Default
set
set
true
The set to iterate.
callback
function:Consumer
true
Invoked for each element. Receives {@code (value, ordinal, set)}; single-argument callbacks receive only the value.
Examples
Iterate over every element in a Set
The callback receives each value in turn.
s = setNew( type="linked", values=[ "a", "b", "c" ] );
s.each( ( Any value ) => {
writeOutput( value & " " );
} );
Result: a b c
Accumulate with each
Result: 15
Related
Last updated
Was this helpful?
