add/ja: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "source>" to "syntaxhighlight>") |
|||
Line 12: | Line 12: | ||
[h: result = sum(val1, val2, ...)] | [h: result = sum(val1, val2, ...)] | ||
[h: result = concat(val1, val2, ...)] | [h: result = concat(val1, val2, ...)] | ||
</ | </syntaxhighlight> | ||
|examples= | |examples= | ||
Line 18: | Line 18: | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[r: add(1,4)] | [r: add(1,4)] | ||
</ | </syntaxhighlight> | ||
戻り値:<source lang="mtmacro" line start=2>5</ | 戻り値:<source lang="mtmacro" line start=2>5</syntaxhighlight> | ||
Line 25: | Line 25: | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[r: add("Mary", "had", "a", "little", "lamb")] | [r: add("Mary", "had", "a", "little", "lamb")] | ||
</ | </syntaxhighlight> | ||
戻り値:<source lang="mtmacro" line start=2>"Maryhadalittlelamb"</ | 戻り値:<source lang="mtmacro" line start=2>"Maryhadalittlelamb"</syntaxhighlight> | ||
Line 32: | Line 32: | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[r: add(1,"4")] | [r: add(1,"4")] | ||
</ | </syntaxhighlight> | ||
戻り値:<source lang="mtmacro" line start=2>"14"</ | 戻り値:<source lang="mtmacro" line start=2>"14"</syntaxhighlight> | ||
}} | }} |
Revision as of 17:05, 14 March 2023
add() Function
• Introduced in version 1.3.b48
数値や文字列を加える。関数のすべての引数が数字であれば、数値の加算が行われ、いずれかの引数が文字列であれば、すべての引数が文字列として連結される。
Usage
<source lang="mtmacro" line> [h: result = add(val1, val2, ...)] [h: result = sum(val1, val2, ...)] [h: result = concat(val1, val2, ...)] </syntaxhighlight>
Examples
====数値====
<source lang="mtmacro" line> [r: add(1,4)] </syntaxhighlight> 戻り値:<source lang="mtmacro" line start=2>5</syntaxhighlight>
文字列
<source lang="mtmacro" line> [r: add("Mary", "had", "a", "little", "lamb")] </syntaxhighlight> 戻り値:<source lang="mtmacro" line start=2>"Maryhadalittlelamb"</syntaxhighlight>
数値と文字列
<source lang="mtmacro" line> [r: add(1,"4")] </syntaxhighlight>
戻り値:<source lang="mtmacro" line start=2>"14"</syntaxhighlight>