BIS fnc nearestNum: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
Lou Montana (talk | contribs) (Page filling) |
||
Line 1: | Line 1: | ||
{{Function|= Comments | {{Function|= Comments | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 8: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | Returns the provided set closest number to the target number. |= Description | ||
____________________________________________________________________________________________ | |||
| [values, value] call [[BIS_fnc_nearestNum]] |= Syntax | |||
|p1= values: [[Array]] of [[Number|Numbers]] - values to choose from |= Parameter 1 | |||
|p2= value: [[Number]] - the reference value |= Parameter 2 | |||
| [[Number]] - the closest value |= Return value | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| < | |x1= <code>_closestValueTo4 = <nowiki>[</nowiki>[1,5,10], 4] [[call]] [[BIS_fnc_nearestNum]]; {{codecomment|// returns 5}}</code> |= Example 1 | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | [[BIS fnc randomNum]], [[random]] |= See also | ||
}} | }} | ||
Revision as of 15:30, 27 April 2018
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