IMath.SumI

Fore Syntax

SumI(Values: Array): Integer;

Fore.NET Syntax

SumI(Values: System.Array): integer;

Parameters

Values. Array of integer numbers.

Description

The SumI method returns the sum of elements (integers) of the specified array.

Comments

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.

Fore Example

To execute the example, add a link to the MathFin system assembly.

Sub UserProc;
Var
    r: Integer;
    Arr: Array[4Of 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.

Fore.NET Example

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[4Of 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:

IMath