Method EinvoiceDecimal():sum() Professional

Calculates the sum of an array of values.

Syntax
:sum( <aList> ) --> oSum
Parameters
<aList>
An array of values, each specified as a numeric value, a character string or an EinvoiceDecimal object.
Return

A new EinvoiceDecimal object with the sum of all elements, or with the value zero if <aList> is empty or not an array.

Description

Calculates the sum of all elements of an array. Each element is converted via EinvoiceDecimal():of() and added via :add(), starting from zero. The method is used by AbstractEinvoice:toModel() to calculate the invoice totals.

If <aList> is not an array, the method returns zero. If an element cannot be converted, a runtime error is raised.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.