Difference between revisions of "Foreach"
From Sega Retro
(I didn't realise I had got this working) |
|||
Line 9: | Line 9: | ||
}} | }} | ||
<noinclude>[[Category:Experimental templates]] | <noinclude>[[Category:Experimental templates]] | ||
− | {{foreach|list=Whoop, gloop, bloop, doop, shoop|delimiter=,| | + | A template for iterating through a list and doing something to each item. |
− | <br/> | + | |
+ | ==Examples== | ||
+ | <pre> | ||
+ | {{foreach | ||
+ | |list=Whoop, gloop, bloop, doop, shoop | ||
+ | |delimiter=, | ||
+ | |<br/> | ||
*[value] | *[value] | ||
+ | }} | ||
+ | </pre> | ||
+ | Produces: | ||
+ | |||
+ | {{foreach | ||
+ | |list=Whoop, gloop, bloop, doop, shoop | ||
+ | |delimiter=, | ||
+ | |<br/> | ||
+ | *[value] | ||
+ | }} | ||
+ | |||
+ | <pre> | ||
+ | {{foreach | ||
+ | |list=Mega Drive-Master System-Saturn-Dreamcast | ||
+ | |delimiter=- | ||
+ | |[[[value]]] | ||
+ | }} | ||
+ | </pre> | ||
+ | Produces: | ||
+ | |||
+ | {{foreach | ||
+ | |list=Mega Drive-Master System-Saturn-Dreamcast | ||
+ | |delimiter=- | ||
+ | |[[[value]]] | ||
}} | }} | ||
</noinclude> | </noinclude> |
Revision as of 14:04, 20 July 2018
A template for iterating through a list and doing something to each item.
Examples
{{foreach |list=Whoop, gloop, bloop, doop, shoop |delimiter=, |<br/> *[value] }}
Produces:
- Whoop
- gloop
- bloop
- doop
- shoop
{{foreach |list=Mega Drive-Master System-Saturn-Dreamcast |delimiter=- |[[[value]]] }}
Produces:
Mega Drive Master System Saturn Dreamcast