Home > Foresight Analytics Platform > Web Application and Desktop Application > Application Development and Functionality Enhancement > Developing in Development Environment > Description of System Assemblies > MathFin > MathFin Assembly Interfaces > IMath > IMath.Sum
Sum(Values: Array): Double;
Values. Array of real numbers.
The Sum method returns the sum of elements of the specified array.
If an array of real numbers contains gaps, the function returns error.
The function works correctly with both one-dimension and two-dimension arrays.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r: Double;
Arr: Array[4] Of Double;
Begin
Arr[0] := -5;
Arr[1] := 15.08;
Arr[2] := 30.12;
Arr[3] := 5.94;
r := Math.Sum(Arr);
Debug.WriteLine(r);
End Sub UserProc;
After executing the example the console window displays the sum of array elements equal to 46.14.
See also: