add/ja: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
m (Text replacement - "<source" to "<syntaxhighlight")
 
(4 intermediate revisions by 2 users not shown)
Line 8: Line 8:


|usage=
|usage=
<source lang="mtmacro" line>
<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, ...)]
</source>
</syntaxhighlight>


|examples=  
|examples=  
====数値====<!--Number-->
====数値====<!--Number-->
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: add(1,4)]
[r: add(1,4)]
</source>
</syntaxhighlight>
戻り値:<source lang="mtmacro" line start=2>5</source>
戻り値:<syntaxhighlight lang="mtmacro" line start=2>5</syntaxhighlight>




====文字列====<!--String-->
====文字列====<!--String-->
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: add("Mary", "had", "a", "little", "lamb")]
[r: add("Mary", "had", "a", "little", "lamb")]
</source>
</syntaxhighlight>
戻り値:<source lang="mtmacro" line start=2>"Maryhadalittlelamb"</source>
戻り値:<syntaxhighlight lang="mtmacro" line start=2>"Maryhadalittlelamb"</syntaxhighlight>




====数値と文字列====<!--Numbers and Strings-->
====数値と文字列====<!--Numbers and Strings-->
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: add(1,"4")]
[r: add(1,"4")]
</source>
</syntaxhighlight>
戻り値:<source lang="mtmacro" line start=2>"14"</source>
戻り値:<syntaxhighlight lang="mtmacro" line start=2>"14"</syntaxhighlight>


}}
}}

Latest revision as of 23:59, 14 March 2023

Languages:  English  • 日本語


add() Function

Introduced in version 1.3.b48
数値や文字列を加える。関数のすべての引数が数字であれば、数値の加算が行われ、いずれかの引数が文字列であれば、すべての引数が文字列として連結される。

Usage

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

Examples

====数値====
[r: add(1,4)]
戻り値:
5


文字列

[r: add("Mary", "had", "a", "little", "lamb")]
戻り値:
"Maryhadalittlelamb"


数値と文字列

[r: add(1,"4")]
戻り値:
"14"

Languages:  English  • 日本語