add: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function add== 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...)
 
No edit summary
Line 4: Line 4:
===Usage===
===Usage===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: add(val1, val2, ...)]
[h: result = add(val1, val2, ...)]
[h: sum(val1, val2, ...)]
[h: result = sum(val1, val2, ...)]
[h: concat(val1, val2, ...)]
[h: result = concat(val1, val2, ...)]
</source>
</source>



Revision as of 12:26, 1 December 2008

Function add

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

[r: add(1,4)]

Returns 5.

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

Returns "Maryhadalittlelamb".

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

Returns "14".