BIS fnc conditionalSelect: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
m (1 revision)
(No difference)

Revision as of 14:47, 25 July 2014


Hover & click on the images for description

Description

Description:
/************************************************************
	Conditional Select

Parameters: [array, {condition}]

This returns a sub-array of elements that satisfy a specific condition.
The originally passed array is NOT modified!

The function takes, in order, every element of the passed array,
evaluates it in the condition, and, if the condition is true, adds
it to the return array.

In the condition, the currently tested element is assigned to
the variable "_x".

Care must be taken that the condition won't cause errors. For
example, if your condition assumes all elements are numbers,
errors will occur if your array includes strings.

This function is similar to the "count" command, only it returns
the elements of the array that satisfy the condition, rather
than simply returning the count.

Example: [[10,0,8,2,6,4], {_x > 5}] call BIS_fnc_conditionalSelect
Returns: [10,8,6]

Example: [[10,true,8,player], {typename _x == "STRING"}] call BIS_fnc_conditionalSelect
Returns: []

************************************************************/

(Placeholder description extracted from the function header by BIS_fnc_exportFunctionsToWiki)
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
Syntax needed
Return Value:
Return value needed

Examples

Example 1:

Additional Information

See also:
See also needed

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section