BIS fnc nearestNum: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) (Page filling) |
m (template:command argument fix) |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Returns the provided set closest number to the target number. |= | | Returns the provided set closest number to the target number. |DESCRIPTION= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [values, value] call [[BIS_fnc_nearestNum]] |= | | [values, value] call [[BIS_fnc_nearestNum]] |SYNTAX= | ||
|p1= values: [[Array]] of [[Number|Numbers]] - values to choose from |= | |p1= values: [[Array]] of [[Number|Numbers]] - values to choose from |PARAMETER1= | ||
|p2= value: [[Number]] - the reference value |= | |p2= value: [[Number]] - the reference value |PARAMETER2= | ||
| [[Number]] - the closest value |= | | [[Number]] - the closest value |RETURNVALUE= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>_closestValueTo4 = <nowiki>[</nowiki>[1,5,10], 4] [[call]] [[BIS_fnc_nearestNum]]; {{codecomment|// returns 5}}</code> |= | |x1= <code>_closestValueTo4 = <nowiki>[</nowiki>[1,5,10], 4] [[call]] [[BIS_fnc_nearestNum]]; {{codecomment|// returns 5}}</code> |EXAMPLE1= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[BIS fnc randomNum]], [[random]] |= | | [[BIS fnc randomNum]], [[random]] |SEEALSO= | ||
}} | }} | ||
Revision as of 14:32, 7 April 2019
Description
- Description:
- Returns the provided set closest number to the target number.
- Execution:
- call
- Groups:
- Uncategorised
Syntax
- Syntax:
- [values, value] call BIS_fnc_nearestNum
- Parameters:
- values: Array of Numbers - values to choose from
- value: Number - the reference value
- Return Value:
- Number - the closest value
Examples
- Example 1:
_closestValueTo4 = [[1,5,10], 4] call BIS_fnc_nearestNum; // returns 5
Additional Information
- See also:
- BIS fnc randomNumrandom
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