findAny: Difference between revisions
Lou Montana (talk | contribs) m (Some wiki formatting) |
BrettMayson (talk | contribs) mNo edit summary |
||
| (One intermediate revision by one other user not shown) | |||
| Line 4: | Line 4: | ||
|version1= 2.10 | |version1= 2.10 | ||
|descr= Returns the zero-based index of the first element in array A that also exists in array B. If no common elements exist it returns -1.<br> | |descr= Returns the zero-based index of the first element in array A that also exists in array B. If no common elements exist it returns -1.<br> | ||
| Line 13: | Line 12: | ||
|s1= searchIn [[findAny]] toFind | |s1= searchIn [[findAny]] toFind | ||
|p1= searchIn: [[Array]] | |p1= searchIn: [[Array]] of [[Anything]] | ||
|p2= toFind: [[Array]] | |p2= toFind: [[Array]] of [[Anything]] | ||
|r1= [[Number]] - the index of the first found item | |r1= [[Number]] - the index of the first found item | ||
Latest revision as of 11:41, 1 January 2026
Description
- Description:
- Returns the zero-based index of the first element in array A that also exists in array B. If no common elements exist it returns -1.
Similar in functionality as find's first syntax, but the second parameter is an array of elements to find. - Groups:
- Arrays
Syntax
- Syntax:
- searchIn findAny toFind
- Parameters:
- searchIn: Array of Anything
- toFind: Array of Anything
- Return Value:
- Number - the index of the first found item
Examples
- Example 1:
- [0,1,2,3,4] findAny [2,4,6,8]; // returns 2
- Example 2:
- [0,1,2,3,4] findAny [8,6,4,2]; // returns 2
- Example 3:
- [0,1,2,3,4] findAny [5,7,9]; // returns -1
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note