Gives the sum of a sequence of numbers

fun total(numbers...)



total is equivalent to adding its elements together:

total(2, 3, 4)
total(-2, 4, 6)

Units are allowed if they are the same kind of measurement. Numbers are converted to the same units and added:

total(200 meters, 500 feet, .5 km)
total(2 hours, 20 euros)
0.85 km

Nested lists and ranges are added together:

total([1, 2, 3], 1..3)

Numbers are added left to right. This can affect percentages that have special rules when adding them to regular numbers:

total(5, 50%)
total(50%, 5)

The order of elements can also matter when mixing numbers with and without units. Figures assumes numbers have the same unit in a case like 5 + 3 meters which is 8 meters.

total uses the same rule when adding its elements:

total(2 hours, 3, 30 minutes)
total(30 minutes, 3, 2 hours)
5.5 hr
2.55 hr

Didn't find what you were looking for?

Contact Us