SumI(Values: Array): Integer;
SumI(Values: System.Array): integer;
Values. Array of integer numbers.
The SumI method returns the sum of elements (integers) of the specified array.
It is required to use an array of value of the Integer type.
The function works correctly with both one-dimension and two-dimension arrays.
To get the sum of real numbers, use the IMath.Sum method.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r: Integer;
Arr: Array[4] Of Integer;
Begin
Arr[0] := -5;
Arr[1] := 158;
Arr[2] := 30;
Arr[3] := 5;
r := math.SumI(Arr);
Debug.WriteLine(r);
End Sub UserProc;
After executing the example the console window displays the sum of array elements equal to 188.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.MathFin;
…
Public Shared Sub Main(Params: StartParams);
Var
r: integer;
Math: MathClass = New MathClass();
Arr: Array[4] Of integer;
Begin
Arr[0] := -5;
Arr[1] := 158;
Arr[2] := 30;
Arr[3] := 5;
r := math.SumI(Arr);
System.Diagnostics.Debug.WriteLine(r);
End Sub;
See also: