CBA_fnc_filter

Description

Filter each element of an array via a function.

Data passed to the function on each iteration,

  • _x - Element of _array.

Parameters

_arrayArray ARRAY
_filterFunction to filter each element <CODE>
_inPlacetrue: alter array, false: copy array (optional, default: false) <BOOLEAN>

Returns

Filtered array ARRAY

Examples

// Filter to create a new array.
_original = [1, 2, 3];
_filtered = [_original, {_x + 1}] call CBA_fnc_filter;
// _original ==> [1, 2, 3]
// _filtered ==> [2, 3, 4]

// Filter original array in place.
_original = [1, 2, 3];
[_original, {_x * 10}, true] call CBA_fnc_filter;
// _original ==> [10, 20, 30]

Author

Spooner, commy2

Array to read from [Array]
Close