add: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Languages|add}} | |||
{{MacroFunction | {{MacroFunction | ||
|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. | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: result = add(val1, val2, ...)] | [h: result = add(val1, val2, ...)] | ||
[h: result = sum(val1, val2, ...)] | [h: result = sum(val1, val2, ...)] | ||
[h: result = concat(val1, val2, ...)] | [h: result = concat(val1, val2, ...)] | ||
</ | </syntaxhighlight> | ||
|examples= | |examples= | ||
====Numbers==== | ====Numbers==== | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: add(1,4)] | [r: add(1,4)] | ||
</ | </syntaxhighlight> | ||
Returns:< | Returns:<syntaxhighlight lang="mtmacro" line start=2>5</syntaxhighlight> | ||
====Strings==== | ====Strings==== | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: add("Mary", "had", "a", "little", "lamb")] | [r: add("Mary", "had", "a", "little", "lamb")] | ||
</ | </syntaxhighlight> | ||
Returns:< | Returns:<syntaxhighlight lang="mtmacro" line start=2>"Maryhadalittlelamb"</syntaxhighlight> | ||
====Numbers and Strings==== | ====Numbers and Strings==== | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: add(1,"4")] | [r: add(1,"4")] | ||
</ | </syntaxhighlight> | ||
Returns:< | Returns:<syntaxhighlight lang="mtmacro" line start=2>"14"</syntaxhighlight> | ||
}} | }} | ||
[[Category:Mathematical Function]] | [[Category:Mathematical Function]] | ||
[[Category:String Function]] | [[Category:String Function]] | ||
{{Languages|add}} |
Latest revision as of 23:59, 9 February 2023
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====
Returns:
Returns:
Returns:
[r: add(1,4)]
5
Strings
[r: add("Mary", "had", "a", "little", "lamb")]
"Maryhadalittlelamb"
Numbers and Strings
[r: add(1,"4")]
"14"