sum
Description
Sums all the numbers in a list.
Input / Parameter
Name
Description
Input Type
Default
Options
Required
data
The list of numbers to sum.
List
-
-
Yes
Output
Description
Output Type
Returns the total value of the numbers in the list.
Number
Example
In this example, we will get the sum of numbers in a list and print the result in the console.
Step
Call the function
List.sum
inside theLog.write
function.Then call the function
Conversion.toList
inside theList.sum
function.Enter the data inside the
Conversion.toList
function. In this example, we will enter "3, 1, 5".
Result
The console will print the sum of all the values in the list.
In this example, the value printed will be
9
.
Links
Related Information
See also:
Functions
Last updated