テンプレート:Varadd/doc

提供: wiki
移動先: 案内検索

varadd

safesubst
You can't use {{{|safesubst:}}} in front of #varexists if the var is not defined here, otherwise it will substitute with {{{1|}}} = null and the "if" will be wrong.


{{#if:{{#varexists:{{{1|}}}}}
|{{#vardefine:{{{1}}}|{{#expr:{{#var:{{{1}}}}}+{{{2}}} }} }}
|VAR '''{{{1}}}''' DOESN'T EXIST (YET)}}

1: A = {{#vardefineecho:A|1}}

2: {{#var:A}}

3: {{varadd|A|1}}

4: {{#var:A}}

5: {{varadd|A|3}}

6: {{#var:A}}

7: {{varadd|B|2}}

1: A = {{#vardefineecho:A|1}}

2: {{#var:A}}

3: {{#vardefine:A|構文エラー: 認識できない区切り文字「{」です。 }}

4: {{#var:A}}

5: {{#vardefine:A|構文エラー: 認識できない区切り文字「{」です。 }}

6: {{#var:A}}

7: {{#vardefine:B|構文エラー: 認識できない区切り文字「{」です。 }}