Difference between revisions of "Template:Loop/doc"
Jump to navigation
Jump to search
imported>Schalice |
|||
| Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE --> | <!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE --> | ||
| − | This template is used to produce a simple loop that can repeat up to 150 times. It is not a real loop; it works by conditionally repeating the string. It is a simple version of {{tl|For loop}}. To use it, enter:<br/> | + | This template is used to produce a simple loop that can repeat up to 150 times. It is not a real loop; it works by conditionally repeating the string. It is a simple version of {{tl|For loop}}. |
| + | |||
| + | |||
| + | To use it, enter:<br/> | ||
<code><nowiki>{{loop|times to repeat|string}}</nowiki></code><br/> | <code><nowiki>{{loop|times to repeat|string}}</nowiki></code><br/> | ||
| − | If string contains an equals sign, you must put "|2=string" instead of "|string". Examples: | + | |
| − | *<code><nowiki>{{loop|4|n}}</nowiki></code> | + | |
| − | *<code><nowiki>{{loop|25|test}}</nowiki></code> | + | If '''string''' contains an equals sign, you must put "|2=string" instead of "|string". |
| − | *<code><nowiki>{{#expr:2{{loop|50|*2}}}}</nowiki></code> | + | |
| − | *<code><nowiki>{{loop|9|2==}}</nowiki></code> | + | |
| − | *<code><nowiki>{{loop|3|{{CURRENTYEAR}}}}</nowiki></code> | + | ==Examples:== |
| + | *<code><nowiki>{{loop|4|n}}</nowiki></code> | ||
| + | ;{{loop|4|n}} | ||
| + | |||
| + | |||
| + | *<code><nowiki>{{loop|25|test}}</nowiki></code> | ||
| + | ;{{loop|25|test}} | ||
| + | |||
| + | |||
| + | *<code><nowiki>{{#expr:2{{loop|50|*2}}}}</nowiki></code> | ||
| + | ;{{#expr:2{{loop|50|*2}}}} | ||
| + | |||
| + | |||
| + | *<code><nowiki>{{loop|9|2==}}</nowiki></code> (the "2=" must be present) | ||
| + | ;{{loop|9|2==}} | ||
| + | |||
| + | |||
| + | *<code><nowiki>{{loop|3|{{CURRENTYEAR}}}}</nowiki></code> | ||
| + | ;{{loop|3|{{CURRENTYEAR}}}} | ||
| + | |||
| + | |||
*{{xpdop3p3c|loop|3|||ab}} | *{{xpdop3p3c|loop|3|||ab}} | ||
Revision as of 23:06, 11 February 2012
| 40px | This is a documentation subpage for Template:Loop. It contains usage information, categories and other content that is not part of the original template page. |
This template is used to produce a simple loop that can repeat up to 150 times. It is not a real loop; it works by conditionally repeating the string. It is a simple version of {{For loop}}.
To use it, enter:
{{loop|times to repeat|string}}
If string contains an equals sign, you must put "|2=string" instead of "|string".
Examples:
{{loop|4|n}}
- nnnn
{{loop|25|test}}
- testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
{{#expr:2{{loop|50|*2}}}}
- 2.2517998136852E+15
{{loop|9|2==}}(the "2=" must be present)
- =========
{{loop|3|{{CURRENTYEAR}}}}
- 202620262026
See also
- Template:for loop (backlinks edit)
- Template:repeat (backlinks edit)
- Template:simple recursion (backlinks edit)