math.Sum
Returns the sum of all numbers. Accepts scalars, slices, or both.
- Syntax
- math.Sum VALUE...
- Returns
- float64
Usage
The math.Sum function returns the sum of all numbers. Each argument can be a number or a slice of numbers.
Examples
{{ math.Sum 1 2 }} → 3With a slice:
{{ math.Sum (slice 1 2 3 4) }} → 10With numbers and slices:
{{ math.Sum 1 (slice 2 3) 4 }} → 10Last updated:
October 21, 2026
:
content: Apply style guide to math functions (658ef2b60)
Improve this page