Sum macro
Learn how to calculate the sum of a collection of numbers.
This macro calculates the sum of a collection of numbers.
The sum is the result of adding all the numbers in the collection. For example, the sum of the numbers 2, 3, 4, 7, and 9 is 25. If the collection is empty, the result is zero.
Syntax
This macro has the following syntax:
sum of /*<collection>*/
You can also prefix the macro with a definite article for readability:
the sum of /*<collection>*/
Parameters
These are the supported parameters:
- collection
The collection of numbers you want to sum. Elements are automatically converted to numbers if necessary.
Examples
Here is an example of how to sum a collection of numbers:
sum of [1, 2, "3"] // 6