Navigation:  thinBasic Modules > Core > Array functions >

ARRAY SUM

Previous pageReturn to chapter overviewNext page

 

Description

 

Sum all array elements returning result operation. Array can be any numeric or even string type. Conversion will take care automatically.

 

Syntax

 

n = ARRAY SUM ArrayVariable([StartIndex]) [FOR nElements]

 

Returns

 

Numeric

 

Parameters

 

Name

Type

Optional

Meaning

ArrayVariable


No

Name of a declared and already dimensioned array.

StartIndex

Number

Yes

The element index inside the array from which to start. If omitted, 1 is assumed

nElements

Number

Yes

Number of elements to use starting from StartIndex. If omitted, end of the array is assumed.

 

Remarks

 

Restrictions

 

See also

 

LBound, UBound, ARRAY ASSIGN,

 

Examples