User:Aichon/Sandbox/Templates1: Difference between revisions
From The Urban Dead Wiki
< User:Aichon | Sandbox
Jump to navigationJump to search
(New sandbox page (if equal)) |
No edit summary |
||
Line 1: | Line 1: | ||
{{switch | <includeonly>{{switch | ||
|{{{1}}} | |{{{1}}} | ||
|case: {{{2}}}={{{3}}} | |case: {{{2}}}={{{3}}} | ||
|default={{{4}}} | |default={{{4}}} | ||
}} | }}</includeonly> | ||
<noinclude>Basically, you'd just say: | |||
<pre>{{if equal | |||
|variable1 | |||
|variable2 | |||
|result_if_true | |||
|result_if_false | |||
}}</pre> | |||
...and it'd spit out the result for you, based on the variables you fed it. The variables don't have to be anything in particular, so they could be any ol' string. | |||
An example might look like: | |||
<pre>{{if equal|a|b|c|d}}</pre> | |||
which would spit out d, since a and b are not equal. On the other hand, with | |||
<pre>{{if equal|a|a|c|d}}</pre> | |||
you'd get c, since a equals itself. | |||
</noinclude> |
Revision as of 06:24, 22 December 2009
Basically, you'd just say:
{{if equal |variable1 |variable2 |result_if_true |result_if_false }}
...and it'd spit out the result for you, based on the variables you fed it. The variables don't have to be anything in particular, so they could be any ol' string.
An example might look like:
{{if equal|a|b|c|d}}
which would spit out d, since a and b are not equal. On the other hand, with
{{if equal|a|a|c|d}}
you'd get c, since a equals itself.