Skip to main content
Version: 8.1

system.math.sum

This function is used in Python Scripting.

Description

Given a sequence of values, calculates the sum of all values. The sum is the number returned by addition.

Returns NaN (Not a Number) if passed an empty sequence.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.math.sum(values)

Parameters

TypeParameterDescription
List[Float]valuesA sequence of numerical values. Accepts both integers and floats. The sequence may not contain None type values. However, passing a None type object instead of a Sequence of numerical values will return NaN.

Returns

Float - The sum of all values in the values parameter, or NaN if values was empty or null.

Scope

Gateway, Vision Client, Perspective Session

Code Examples

Example #1 - Summing All Values In List
# Create a list of values.
values = [3.5, 5.6, 7.8, 7.4, 3.8]

# Print the resulting value.
print system.math.sum(values)

Keywords

system math sum, math.sum