Up |
tabcmpI
Compare two integer arrays. The two arrays can have differents sizes. This function
compare the integer of each index while this value is the same between the two arrays.
The return value is the last same index.
Example :
10 | 5 | 2 | 25 | 20 | 10 | 3
array 1
10 | 5 | 2 | 25 | 20 | 12 | 3 | 9
array 2
the return value between array 1 and array 2 is 4 (10 = 10, 5 = 5, 2 = 2, 25 = 25, 20 = 20 but 10 != 12)
Prototype :
fun [tab I tab I] I
- tab I : an integer array
- tab I : another integer array
Return : I the last same index, nil if the first index (0) is already different.
See also
Example
fun main ()=
_showconsole;
let mktab 5 1 -> array_1 in // array with a size = 5 and fill to 1
let mktab 10 1 -> array_2 in // array with a size = 10 and fill to 1
_fooId tabcmpI array_1 array_2; // 4 (index 0, 1, 2, 3, 4)
0;;
fun main ()=
_showconsole;
let mktab 3 nil -> array_1 in
let mktab 4 nil -> array_2 in
(
set array_1.0 = set array_2.0 = 1;
set array_1.1 = set array_2.1 = 2;
set array_1.2 = 4;
set array_2.2 = 11;
set array_2.3 = 100;
_fooId tabcmpF array_1 array_2; // 1 (index 0, 1)
);
0;;
Note
Don't forget that the first index is 0, not 1 !