Difference between revisions of "Template:ForEach"

From West Of Vipers Gate
m
m
Line 21: Line 21:
 
| {{#if: {{{join|}}} | {{{join}}} }}{{ {{{1}}} |{{#if: 1|{{{21}}}}}}} }}</onlyinclude>
 
| {{#if: {{{join|}}} | {{{join}}} }}{{ {{{1}}} |{{#if: 1|{{{21}}}}}}} }}</onlyinclude>
 
== Usage ==
 
== Usage ==
<pre>{{ForEach|Template_To_Use|join=&nbsp;
+
<pre>{{ForEach|Template_To_Use|join=<string between invocations>
 
|First
 
|First
 
|Second
 
|Second
Line 27: Line 27:
 
|Fourth
 
|Fourth
 
}}</pre>
 
}}</pre>
Using Repeat/Sample (which just prepends "Hello " to the string) yields:
+
Using Repeat/Sample for the template (which just prepends "Hello " to the string) and join=,&nbsp; yields:
  
{{ForEach|Repeat/Sample|join=&nbsp;
+
{{ForEach|Repeat/Sample|join=,&nbsp;
 
|First
 
|First
 
|Second
 
|Second

Revision as of 15:41, 18 September 2021

Usage

{{ForEach|Template_To_Use|join=<string between invocations>
|First
|Second
|Third
|Fourth
}}

Using Repeat/Sample for the template (which just prepends "Hello " to the string) and join=,  yields:

Hello First, Hello Second, Hello Third, Hello Fourth