Difference between revisions of "Addvar"

From Sega Retro

 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#vardefine:{{{1}}}|{{#expr:{{#var:{{{1}}}}}+{{#if:{{{2|}}}|{{{2}}}|0}}}}}}</includeonly><noinclude>
+
<includeonly>{{#ifeq:{{#var:{{{1}}}}}||{{#vardefine:{{{1}}}|{{{2}}}}}|{{#vardefine:{{{1}}}|{{#expr:{{#var:{{{1}}}}}+{{#if:{{{2|}}}|{{{2}}}|0}}}}}}}}</includeonly><noinclude>
 
Add a value to a variable.
 
Add a value to a variable.
  
Line 13: Line 13:
 
{{#vardefine:testvalue|5}}{{addvar|testvalue|3}}
 
{{#vardefine:testvalue|5}}{{addvar|testvalue|3}}
 
testvalue = {{#var:testvalue}}
 
testvalue = {{#var:testvalue}}
[[Category:Sega Retro templates]]
+
[[Category:Templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 13:03, 1 January 2022

Add a value to a variable.

Usage

{{#vardefine:testvalue|5}}
{{addvar|testvalue|3}}
testvalue = {{#var:testvalue}}

Returns:


testvalue = 8