Difference between revisions of "Template:Ifor"
imported>Hornoir |
imported>Hornoir |
||
| Line 1: | Line 1: | ||
| − | {{#ifeq:{{lc:{{{test|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test|n}}}}}|{{lc:{{{val|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test0|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test0|n}}}}}|{{lc:{{{val0|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test1|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test1|n}}}}}|{{lc:{{{val1|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test2|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test2|n}}}}}|{{lc:{{{val2|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test3|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test3|n}}}}}|{{lc:{{{val3|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test4|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test4|n}}}}}|{{lc:{{{val4|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test5|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test5|n}}}}}|{{lc:{{{val5|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test6|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test6|n}}}}}|{{lc:{{{val6|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test7|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test7|n}}}}}|{{lc:{{{val7|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test8|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test8|n}}}}}|{{lc:{{{val8|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test9|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test9|n}}}}}|{{lc:{{{val9|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test10|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test10|n}}}}}|{{lc:{{{val10|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test11|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test11|n}}}}}|{{lc:{{{val11|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test12|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test12|n}}}}}|{{lc:{{{val12|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test13|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test13|n}}}}}|{{lc:{{{val13|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test14|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test14|n}}}}}|{{lc:{{{val14|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test15|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test15|n}}}}}|{{lc:{{{val15|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test16|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test16|n}}}}}|{{lc:{{{val16|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test17|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test17|n}}}}}|{{lc:{{{val17|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test18|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test18|n}}}}}|{{lc:{{{val18|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test19|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test19|n}}}}}|{{lc:{{{val19|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test20|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test20|n}}}}}|{{lc:{{{val20|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test21|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test21|n}}}}}|{{lc:{{{val21|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test22|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test22|n}}}}}|{{lc:{{{val22|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test23|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test23|n}}}}}|{{lc:{{{val23|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test24|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test24|n}}}}}|{{lc:{{{val24|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test25|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test25|n}}}}}|{{lc:{{{val25|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test26|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test26|n}}}}}|{{lc:{{{val26|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test27|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test27|n}}}}}|{{lc:{{{val27|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test28|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test28|n}}}}}|{{lc:{{{val28|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test29|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test29|n}}}}}|{{lc:{{{val29|y}}}}}|{{{then|}}}| |
| − | {{#ifeq:{{lc:{{{test30|n}}}}}|{{lc:{{{ | + | {{#ifeq:{{lc:{{{test30|n}}}}}|{{lc:{{{val30|y}}}}}|{{{then|}}}|{{{else|}}} |
}} | }} | ||
}} | }} | ||
Latest revision as of 12:56, 21 February 2009
The Template:Tf template extends the #ifeq: parser function, allowing it to pass multiple case strings against the same number of comparison strings. It returns a true result if any single case string is equal to any single comparison string, returning a false result otherwise.
Usage
This template compares if any comparison string (up to 30 unnamed numeric parameters; test1, test2, test3, etc.) equals its matching case string (up to 30 unnamed numeric parameters; val1, val2, val3, etc.) then returns a single result string (parameter then) if any are equal or returns a single optional default result string (parameter else) if none are equal.
The test and val parameters ignore case sensitivity (treat lower- and upper-case as equal inputs) and also ignore pre-integer zeros (e.g., 02 is equal to 2, 002 is equal to 2).
Full blank syntax
{{ifor
| test1 =
| val1 =
| test2 =
| val2 =
| test3 =
| val3 =
<!-- up to 30 test and var parameters can be inputted, using the same method as shown above -->
| then =
| else =
}}
See also
- {{ifeqall}}
- Compares one comparison string against up to 10 case strings with optional result string and default result string outputs.
- {{ifeqany}}
- Compares up to 24 case strings against each other with result string and default result string outputs.
- {{ifequal}}
- Compares up to 16 comparison strings against an equal number of case strings.
| The above documentation is transcluded from Template:Ifor/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |