Adds the values of corresponding elements in two dynamic arrays.
function adds the value of each element in dynarray1
to the corresponding element in dynarray2
. It then returns a dynamic array containing the results of these additions. If a dynarray
element value is a null string, missing, or a non-numeric value, ADDS
parses its value as 0 (zero).
If the two dynamic arrays have different numbers of elements, the returned dynamic array has the number of elements of the longer dynamic array. By default, the shorter dynamic array is padded with 0 value elements for the purpose of the arithmetic operation. You can also use the REUSE
function to define behavior when specifying two dynamic arrays with different numbers of elements.
You can use the NUMS
function to determine if the elements in a dynamic array are numeric. You can use the SUBS
(modulo division), and PWRS
(exponentiation) functions to perform other arithmetic operations on the corresponding elements of two dynamic arrays.
To add together the element values within a single dynamic array, use either the SUM
function (for single-level dynamic arrays) or the SUMMATION
function (for multi-level dynamic arrays),
The following example uses the ADDS
function to add the elements of two dynamic arrays:
PRINT a; ! returns 11ý22ý33ý44
PRINT ADDS(a,b); ! returns 21ý31ý41ý51