Sum

Syntax

	sum($num1, ..., $numN)

$set.sum()

Description

Calculates the sum of the given values. All values must be numbers.

The function can be called either with multiple arguments or with a list or set as a single argument. null values are filtered out and have no influence on the result.

Parameters

Name Type Description Mandatory Default
num Number The numbers that should be added together. One of them must be defined.
set Set A set or list of numbers to add together.

Return value

Type: Number

The sum of the specified elements.

Examples

Simple addition

	sum(5, 10, 20)

Output: 35

Addition with a set

	list(1, 2, 3, 4).sum()

Output: 10

Addition with zero values

	list(1, null, 2, null, 3, 4).sum()

Output: 10

The null values are filtered out.