Difference between pages "Template:For loop" and "Template:Here"

From Event-B
(Difference between pages)
Jump to navigationJump to search
imported>Mathieu
m
 
imported>Mathieu
m (New page: {{{1}}}<noinclude> ;Template makes the link to a section title on the same page.:Preceded by boilerplate like (See ''Here Template'' below) or (For details, see ''Here Templat...)
 
Line 1: Line 1:
{{{{{substfa|}}}forLoop/aux|{{{1}}}|substa={{{substa|}}}|substc={{{substc|}}}|forcall={{{call}}}|empty=|pv={{{{{substf|}}}#ifeq:{{{pv|+}}}|{{{pv|-}}}|{{{pv}}}|1}}|prefix={{{{{substf|}}}#ifeq:{{{prefix|+}}}|{{{prefix|-}}}|{{{prefix}}}}}|postfix={{{{{substf|}}}#ifeq:{{{postfix|+}}}|{{{postfix|-}}}|{{{postfix}}}}}|pc1n={{{{{substf|}}}#ifeq:{{{pc1n|+}}}|{{{pc1n|-}}}|{{{pc1n}}}|}}|pc1v={{{{{substf|}}}#ifeq:{{{pc1v|+}}}|{{{pc1v|-}}}|{{{pc1v}}}|}}|pc2n={{{{{substf|}}}#ifeq:{{{pc2n|+}}}|{{{pc2n|-}}}|{{{pc2n}}}|}}|pc2v={{{{{substf|}}}#ifeq:{{{pc2v|+}}}|{{{pc2v|-}}}|{{{pc2v}}}|}}|pc3n={{{{{substf|}}}#ifeq:{{{pc3n|+}}}|{{{pc3n|-}}}|{{{pc3n}}}|}}|pc3v={{{{{substf|}}}#ifeq:{{{pc3v|+}}}|{{{pc3v|-}}}|{{{pc3v}}}|}}|pc4n={{{{{substf|}}}#ifeq:{{{pc4n|+}}}|{{{pc4n|-}}}|{{{pc4n}}}|}}|pc4v={{{{{substf|}}}#ifeq:{{{pc4v|+}}}|{{{pc4v|-}}}|{{{pc4v}}}|}}|pc5n={{{{{substf|}}}#ifeq:{{{pc5n|+}}}|{{{pc5n|-}}}|{{{pc5n}}}|}}|pc5v={{{{{substf|}}}#ifeq:{{{pc5v|+}}}|{{{pc5v|-}}}|{{{pc5v}}}|}}|{{{{{substf|}}}#ifeq:{{{2|+}}}|{{{2|-}}}|{{{2}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{3|+}}}|{{{3|-}}}|{{{3}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{4|+}}}|{{{4|-}}}|{{{4}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{5|+}}}|{{{5|-}}}|{{{5}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{6|+}}}|{{{6|-}}}|{{{6}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{7|+}}}|{{{7|-}}}|{{{7}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{8|+}}}|{{{8|-}}}|{{{8}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{9|+}}}|{{{9|-}}}|{{{9}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{10|+}}}|{{{10|-}}}|{{{10}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{11|+}}}|{{{11|-}}}|{{{11}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{12|+}}}|{{{12|-}}}|{{{12}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{13|+}}}|{{{13|-}}}|{{{13}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{14|+}}}|{{{14|-}}}|{{{14}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{15|+}}}|{{{15|-}}}|{{{15}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{16|+}}}|{{{16|-}}}|{{{16}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{17|+}}}|{{{17|-}}}|{{{17}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{18|+}}}|{{{18|-}}}|{{{18}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{19|+}}}|{{{19|-}}}|{{{19}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{20|+}}}|{{{20|-}}}|{{{20}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{21|+}}}|{{{21|-}}}|{{{21}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{22|+}}}|{{{22|-}}}|{{{22}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{23|+}}}|{{{23|-}}}|{{{23}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{24|+}}}|{{{24|-}}}|{{{24}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{25|+}}}|{{{25|-}}}|{{{25}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{26|+}}}|{{{26|-}}}|{{{26}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{27|+}}}|{{{27|-}}}|{{{27}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{28|+}}}|{{{28|-}}}|{{{28}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{29|+}}}|{{{29|-}}}|{{{29}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{30|+}}}|{{{30|-}}}|{{{30}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{31|+}}}|{{{31|-}}}|{{{31}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{32|+}}}|{{{32|-}}}|{{{32}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{33|+}}}|{{{33|-}}}|{{{33}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{34|+}}}|{{{34|-}}}|{{{34}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{35|+}}}|{{{35|-}}}|{{{35}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{36|+}}}|{{{36|-}}}|{{{36}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{37|+}}}|{{{37|-}}}|{{{37}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{38|+}}}|{{{38|-}}}|{{{38}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{39|+}}}|{{{39|-}}}|{{{39}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{40|+}}}|{{{40|-}}}|{{{40}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{41|+}}}|{{{41|-}}}|{{{41}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{42|+}}}|{{{42|-}}}|{{{42}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{43|+}}}|{{{43|-}}}|{{{43}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{44|+}}}|{{{44|-}}}|{{{44}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{45|+}}}|{{{45|-}}}|{{{45}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{46|+}}}|{{{46|-}}}|{{{46}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{47|+}}}|{{{47|-}}}|{{{47}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{48|+}}}|{{{48|-}}}|{{{48}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{49|+}}}|{{{49|-}}}|{{{49}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{50|+}}}|{{{50|-}}}|{{{50}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{51|+}}}|{{{51|-}}}|{{{51}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{52|+}}}|{{{52|-}}}|{{{52}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{53|+}}}|{{{53|-}}}|{{{53}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{54|+}}}|{{{54|-}}}|{{{54}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{55|+}}}|{{{55|-}}}|{{{55}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{56|+}}}|{{{56|-}}}|{{{56}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{57|+}}}|{{{57|-}}}|{{{57}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{58|+}}}|{{{58|-}}}|{{{58}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{59|+}}}|{{{59|-}}}|{{{59}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{60|+}}}|{{{60|-}}}|{{{60}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{61|+}}}|{{{61|-}}}|{{{61}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{62|+}}}|{{{62|-}}}|{{{62}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{63|+}}}|{{{63|-}}}|{{{63}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{64|+}}}|{{{64|-}}}|{{{64}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{65|+}}}|{{{65|-}}}|{{{65}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{66|+}}}|{{{66|-}}}|{{{66}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{67|+}}}|{{{67|-}}}|{{{67}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{68|+}}}|{{{68|-}}}|{{{68}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{69|+}}}|{{{69|-}}}|{{{69}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{70|+}}}|{{{70|-}}}|{{{70}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{71|+}}}|{{{71|-}}}|{{{71}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{72|+}}}|{{{72|-}}}|{{{72}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{73|+}}}|{{{73|-}}}|{{{73}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{74|+}}}|{{{74|-}}}|{{{74}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{75|+}}}|{{{75|-}}}|{{{75}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{76|+}}}|{{{76|-}}}|{{{76}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{77|+}}}|{{{77|-}}}|{{{77}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{78|+}}}|{{{78|-}}}|{{{78}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{79|+}}}|{{{79|-}}}|{{{79}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{80|+}}}|{{{80|-}}}|{{{80}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{81|+}}}|{{{81|-}}}|{{{81}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{82|+}}}|{{{82|-}}}|{{{82}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{83|+}}}|{{{83|-}}}|{{{83}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{84|+}}}|{{{84|-}}}|{{{84}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{85|+}}}|{{{85|-}}}|{{{85}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{86|+}}}|{{{86|-}}}|{{{86}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{87|+}}}|{{{87|-}}}|{{{87}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{88|+}}}|{{{88|-}}}|{{{88}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{89|+}}}|{{{89|-}}}|{{{89}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{90|+}}}|{{{90|-}}}|{{{90}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{91|+}}}|{{{91|-}}}|{{{91}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{92|+}}}|{{{92|-}}}|{{{92}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{93|+}}}|{{{93|-}}}|{{{93}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{94|+}}}|{{{94|-}}}|{{{94}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{95|+}}}|{{{95|-}}}|{{{95}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{96|+}}}|{{{96|-}}}|{{{96}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{97|+}}}|{{{97|-}}}|{{{97}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{98|+}}}|{{{98|-}}}|{{{98}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{99|+}}}|{{{99|-}}}|{{{99}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{100|+}}}|{{{100|-}}}|{{{100}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{101|+}}}|{{{101|-}}}|{{{101}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{102|+}}}|{{{102|-}}}|{{{102}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{103|+}}}|{{{103|-}}}|{{{103}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{104|+}}}|{{{104|-}}}|{{{104}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{105|+}}}|{{{105|-}}}|{{{105}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{106|+}}}|{{{106|-}}}|{{{106}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{107|+}}}|{{{107|-}}}|{{{107}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{108|+}}}|{{{108|-}}}|{{{108}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{109|+}}}|{{{109|-}}}|{{{109}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{110|+}}}|{{{110|-}}}|{{{110}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{111|+}}}|{{{111|-}}}|{{{111}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{112|+}}}|{{{112|-}}}|{{{112}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{113|+}}}|{{{113|-}}}|{{{113}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{114|+}}}|{{{114|-}}}|{{{114}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{115|+}}}|{{{115|-}}}|{{{115}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{116|+}}}|{{{116|-}}}|{{{116}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{117|+}}}|{{{117|-}}}|{{{117}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{118|+}}}|{{{118|-}}}|{{{118}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{119|+}}}|{{{119|-}}}|{{{119}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{120|+}}}|{{{120|-}}}|{{{120}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{121|+}}}|{{{121|-}}}|{{{121}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{122|+}}}|{{{122|-}}}|{{{122}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{123|+}}}|{{{123|-}}}|{{{123}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{124|+}}}|{{{124|-}}}|{{{124}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{125|+}}}|{{{125|-}}}|{{{125}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{126|+}}}|{{{126|-}}}|{{{126}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{127|+}}}|{{{127|-}}}|{{{127}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{128|+}}}|{{{128|-}}}|{{{128}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{129|+}}}|{{{129|-}}}|{{{129}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{130|+}}}|{{{130|-}}}|{{{130}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{131|+}}}|{{{131|-}}}|{{{131}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{132|+}}}|{{{132|-}}}|{{{132}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{133|+}}}|{{{133|-}}}|{{{133}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{134|+}}}|{{{134|-}}}|{{{134}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{135|+}}}|{{{135|-}}}|{{{135}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{136|+}}}|{{{136|-}}}|{{{136}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{137|+}}}|{{{137|-}}}|{{{137}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{138|+}}}|{{{138|-}}}|{{{138}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{139|+}}}|{{{139|-}}}|{{{139}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{140|+}}}|{{{140|-}}}|{{{140}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{141|+}}}|{{{141|-}}}|{{{141}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{142|+}}}|{{{142|-}}}|{{{142}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{143|+}}}|{{{143|-}}}|{{{143}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{144|+}}}|{{{144|-}}}|{{{144}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{145|+}}}|{{{145|-}}}|{{{145}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{146|+}}}|{{{146|-}}}|{{{146}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{147|+}}}|{{{147|-}}}|{{{147}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{148|+}}}|{{{148|-}}}|{{{148}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{149|+}}}|{{{149|-}}}|{{{149}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{150|+}}}|{{{150|-}}}|{{{150}}}|undefined}}|{{{{{substf|}}}#ifeq:{{{151|+}}}|{{{151|-}}}|{{{151}}}|undefined}}}}<noinclude>
+
[[#{{{1}}}|{{{1}}}]]<noinclude>
 
+
;Template makes the link to a section title on the same page.:Preceded by boilerplate like (See ''Here Template'' below)
== Description ==
+
or (For details, see ''Here Template'' above), and so forth.  
The template calls a specified template up to 150 times, where one parameter takes each of a list of values; in addition to the variable parameter, for up to 4 parameters a fixed value can be specified.
 
 
 
== Usage ==
 
(Note the change for the constant values.)
 
 
 
<pre>
 
{{for
 
  |call=template to call
 
  |what to separate the entries with (unnamed parameter; required, but can be the empty string)
 
  |pc1n=name of first parameter with constant value
 
  |pc1v=first constant value
 
  |pc2n=name of second parameter with constant value
 
  |pc2v=second constant value
 
  |pc3n=name of third parameter with constant value
 
  |pc3v=third constant value
 
  |pc4n=name of fourth parameter with constant value
 
  |pc4v=fourth constant value
 
  |pv=name of variable parameter
 
  |prefix=constant first part of the value of pv
 
  |postfix=constant last part of the value of pv
 
  |list of 1 to 150 parameter values (without prefixes and postfixes), with separator "|"
 
    (empty parameter values work in the regular way, they are ''not'' ignored like undefined ones)
 
 
 
}}
 
</pre>
 
 
 
The separator is unnamed, allowing it to start and/or end with [[Help:newlines and spaces|newlines and spaces]]. This parameter should be put before the list. If a parameter value in the list contains an equals sign the list should use named parameters, at least from that point, where it should be noted that e.g. the third item in the list is parameter 4, because parameter 1 is the separator. If the separator contains an equals sign then represent it with <nowiki>{{=}}</nowiki>, see {{tim|1==}}.
 
 
 
==Examples==
 
{| class="wikitable", border=1
 
!Code
 
!Result
 
|-
 
|
 
<pre>1{{for|, 1|00|01|02|03|04|05|06|07|08|09
 
|10|11|12|13|14|15|16|17|18|19
 
|20|21|22|23|24|25|26|27|28|29
 
|30|31|32|33|34|35|36|37|38|39
 
|40|41|42|43|44|45|46|47|48|49
 
|50|51|52|53|54|55|56|57|58|59
 
|60|61|62|63|64|65|66|67|68|69
 
|70|71|72|73|74|75|76|77|78|79
 
|80|81|82|83|84|85|86|87|88|89
 
|90|91|92|93|94|95|96|97|98|99
 
  |call=1x
 
}}</pre>
 
|1{{for|, 1|00|01|02|03|04|05|06|07|08|09
 
|10|11|12|13|14|15|16|17|18|19
 
|20|21|22|23|24|25|26|27|28|29
 
|30|31|32|33|34|35|36|37|38|39
 
|40|41|42|43|44|45|46|47|48|49
 
|50|51|52|53|54|55|56|57|58|59
 
|60|61|62|63|64|65|66|67|68|69
 
|70|71|72|73|74|75|76|77|78|79
 
|80|81|82|83|84|85|86|87|88|89
 
|90|91|92|93|94|95|96|97|98|99
 
  |call=1x
 
}}
 
|}
 
 
 
Note that the last part of the separator is used as a prefix; the first prefix needs to be put separately.
 
 
 
----
 
 
 
<nowiki>{{for|-|a|3||c|g|call=3x}}</nowiki> using {{tim|3x}} gives
 
 
 
{{for|-|a|3||c|g|call=3x}}
 
 
 
<nowiki>{{for|</nowiki>
 
 
 
<nowiki>|a|3||c|g|call=3x}}</nowiki> gives
 
 
 
{{for|
 
 
 
|a|3||c|g|call=3x}}
 
 
 
<pre>
 
{|class="wikitable sortable"
 
|-
 
!Test
 
|-
 
| {{for|
 
{{!}}-
 
{{!}} |a|b|c|d|e|call=3x}}
 
|}
 
</pre>
 
 
 
gives:
 
 
 
{|class="wikitable sortable"
 
|-
 
!Test
 
|-
 
| {{for|
 
{{!}}-
 
{{!}} |a|b|c|d|e|call=3x}}
 
|}
 
 
 
Using {{tim|table row example}},
 
 
 
<pre>
 
{| class="wikitable sortable"
 
|-
 
!number!!reciprocal
 
|-
 
| {{for|
 
{{!}}-
 
{{!}} |call=table row example|3|1|5|3|2}}
 
|}
 
</pre>
 
 
 
gives
 
 
 
{| class="wikitable sortable"
 
|-
 
!number!!reciprocal
 
|-
 
| {{for|
 
{{!}}-
 
{{!}} |call=table row example|3|1|5|3|2}}
 
|}
 
 
 
----
 
 
 
<nowiki>{{for| / |call=short DOW|3|1|5|3|2}}</nowiki> using {{tim|short DOW}} gives
 
:{{for| / |call=short DOW|3|1|5|3|2}}
 
 
 
----
 
 
 
<nowiki>{{for|; |call=t2|pc1n=2|pc1v=constant|abc|def|ghi|postfix=pof}}</nowiki> using {{tim|t2}} gives:
 
 
 
{{for|; |call=t2|pc1n=2|pc1v=constant|abc|def|ghi|postfix=pof}}
 
 
 
----
 
 
 
<nowiki>{{for|, |call=concat and link to w:en:|pc1n=1|pc1v=John_|pv=2||Lennon|Wayne}}
 
</nowiki> using {{timc|concat and link to w:en:}} gives {{for|, |call=concat and link to w:en:|pc1n=1|pc1v=John_|pv=2||Lennon|Wayne}}
 
 
 
A for-call can give a row or column of choice, e.g. using {{tim|power}}:
 
 
 
<nowiki>{{for|,|2|3|call=power|prefix=2,}}</nowiki> gives {{for|,|2|3|call=power|prefix=2,}}
 
 
 
<nowiki>{{for|,|2|3|call=power|prefix=3,}}</nowiki> gives {{for|,|2|3|call=power|prefix=3,}}
 
 
 
<nowiki>{{for|,|2|3|call=power|postfix=,2}}</nowiki> gives {{for|,|2|3|call=power|postfix=,2}}
 
 
 
<nowiki>{{for|,|2|3|call=power|postfix=,3}}</nowiki> gives {{for|,|2|3|call=power|postfix=,3}}
 
 
 
----
 
 
 
A constant parameter is ignored if it is the same as the (implicitly or explicitly given) variable parameter:
 
 
 
<nowiki>{{for|; |call=t2|pc1n=1|pc1v=7|pc2n=2|pc2v=5|abc|def|ghi}}</nowiki> using {{tim|t2}} gives:
 
 
 
{{for|; |call=t2|pc1n=1|pc1v=7|pc2n=2|pc2v=5|abc|def|ghi}}
 
 
 
----
 
 
 
Using {{tim|plus square}}, <nowiki>{{#expr:{{for||call=plus square|pv=1|1|2|3|4|5}}}}</nowiki> gives {{#expr:{{for||call=plus square|pv=1|1|2|3|4|5}}}}.
 
 
 
Semi-recursive: see [[Template talk:Foreach/recursion]]
 
 
 
==Substitution==
 
For successive levels of substitution use one or more or the following (the first, the first two, the first three, or all)  
 
 
 
*substf=subst: - substitute the parser functions in {{tim|for}}
 
*substfa=subst: - substitute the call of auxiliary {{tim|for/aux}}
 
*substa=subst: - substitute the parser functions in for/aux (reduces the number of items from 150 to the actual number)
 
*substfa=subst: - substitute the calls of the user template
 
 
 
If at least the first three are applied, and the separator contains <nowiki>{{!}}</nowiki>, one can replace it with <nowiki>{{subst:!}}</nowiki> to substitute that too.
 
 
 
For full substitution [[Special:ExpandTemplates]] can also be used.
 
 
 
==Old version==
 
Note that formerly this template had a named separator parameter sep.
 
 
 
==See also==
 
*{{tim|foreach}}
 
*{{tim|tblb}}
 
*{{tiw|for loop}}
 
*{{tiw|loop}}
 
*[[Help:Parameter default]]
 
*[[Help:Array]]
 
*[[mw:Extension:LoopFunctions]]
 
  
 +
[[Category:Utility templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 13:25, 11 September 2008

[[#{{{1}}}|{{{1}}}]]

Template makes the link to a section title on the same page.
Preceded by boilerplate like (See Here Template below)

or (For details, see Here Template above), and so forth.