Operation(OperationType: ArrayOperationType, Value: Variant);
OperationType. Type of arithmetic operation.
Value. Value that will be used on executing an operation with array elements.
The Operation method executes arithmetic operation with array elements with the specified value.
The method is used to work with the following data types: Integer, Decimal, Float.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
Matr: Array Of Double;
i, j: Integer;
Begin
// Create a two-dimensional array
Matr := New Double[3, 3];
Matr[0, 0] := 4; Matr[0, 1] := 9; Matr[0, 2] := 3;
Matr[1, 0] := 2; Matr[1, 1] := 15; Matr[1, 2] := 7;
Matr[2, 0] := 8; Matr[2, 1] := 5; Matr[2, 2] := 13;
Debug.WriteLine("Array before operation execution:");
// Display the created array in the console
For i := 0 To Matr.GetUpperBound(1) Do
For j := 0 To Matr.GetUpperBound(2) Do
Debug.Write(Matr[i, j].ToString + " ");
End For;
Debug.WriteLine("");
End For;
// Execute arithmetic operation with array elements
Matr.Operation(ArrayOperationType.Minus, 2);
// Display operation result in the console
Debug.WriteLine("Array after operation execution:");
For i := 0 To Matr.GetUpperBound(1) Do
For j := 0 To Matr.GetUpperBound(2) Do
Debug.Write(Matr[i, j].ToString + " ");
End For;
Debug.WriteLine("");
End For;
End Sub UserProc;
After executing the example the console will display the array before and after operation execution. After executing the operation, values of array elements are decreased by 2:
The array before operation execution:
4 9 3
2 15 7
8 5 13
The array after operation execution:
2 7 1
0 13 5
6 3 11
See also: