IndexOf(Value: Variant): Integer;
Value. The value that should be found in the array.
The IndexOf method searches for the specified value in the array and returns the index of the first occurrence of the corresponding element.
This method is supported for one-dimensional arrays only.
If the value is not found, the method returns "-1".
Add a link to the MathFin system assembly.
Sub UserProc;
Var
Ar: Array[0..20] Of Integer;
i, j: Integer;
Begin
For i := 0 To 20 Do
Ar[i] := Math.RandBetweenI(0, 50);
End For;
j := Ar.IndexOf(10);
End Sub UserProc;
After executing the example random data is written to the Ar one-dimensional array, the "j" variable contains index of the first value 10 found in the array.
See also: