add: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
|name=add
|name=add
|trusted=false
|trusted=false
|version=
|version=1.3.b48
|description=Adds number and/or strings together. If all of the arguments to the function are numbers then a numeric addition is performed, if any of the arguments are strings then all of the arguments are concatenated as a string.
|description=Adds number and/or strings together. If all of the arguments to the function are numbers then a numeric addition is performed, if any of the arguments are strings then all of the arguments are concatenated as a string.



Revision as of 13:06, 25 April 2019

add() Function

Introduced in version 1.3.b48
Adds number and/or strings together. If all of the arguments to the function are numbers then a numeric addition is performed, if any of the arguments are strings then all of the arguments are concatenated as a string.

Usage

[h: result = add(val1, val2, ...)]
[h: result = sum(val1, val2, ...)]
[h: result = concat(val1, val2, ...)]

Examples

====Numbers====
[r: add(1,4)]
Returns:
5


Strings

[r: add("Mary", "had", "a", "little", "lamb")]
Returns:
"Maryhadalittlelamb"


Numbers and Strings

[r: add(1,"4")]
Returns:
"14"