Error getting tags :
error 404Error getting tags :
error 404 sum | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
sum
Basics
Expander triangle
Type
Function
Syntax
sum(numbersList)
Introduced
1.0
Changed
1.1
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Returns the sum of a list of numbers.
Examples

sum(1,5,2,3) -- returns 11

Additional Comments
Expander triangle

Use the sum function to add a group of values together.

Parameters:

The numberList is

* a sequence of parameters, each a number or evaluating to a number or

* a single parameter which is or evaluates to

* a comma-separated list of numbers or

* an array containing only numbers

Value:

The sum function returns a number.

Comments:

The sum function is equivalent to the following statements:

repeat with x = 1 to the number of items of numbersList

add item x of numbersList to sumValue

end repeat

return sumValue

If the numbersList is empty, the sum function returns zero.

Changes to Revolution:

The ability to use an array was introduced in version 1.1. In previous versions, only lists of numbers could be used with the sum function.

User Comments
Expander triangle