Difference between revisions of "Foreach"

From Sega Retro

Line 1: Line 1:
{{#vardefine:tempList|{{{list}}}}}
+
<div style="display:none;">{{#vardefine:tempList|{{{list}}}}}
 
{{#vardefine:delimiter|{{{delimiter}}}}}
 
{{#vardefine:delimiter|{{{delimiter}}}}}
 
{{#vardefine:i|0}}
 
{{#vardefine:i|0}}
 
{{#vardefine:currentValue|NULL}}
 
{{#vardefine:currentValue|NULL}}
 
+
</div>{{#while:
{{#while:
+
| {{#ifexpr:{{#len:{{#var:currentValue}}}} >= {{#len:{{{delimiter}}}}}|true|}}
| {{#ifexpr:{{#len:{{#var:currentValue}}}} >= 3|true|}}
 
 
|{{#vardefine:currentValue|{{#explode:{{#var:tempList}}|{{#var:delimiter}}|{{#var:i}}}}}}{{incvar|i}}
 
|{{#vardefine:currentValue|{{#explode:{{#var:tempList}}|{{#var:delimiter}}|{{#var:i}}}}}}{{incvar|i}}
 
+
{{#if:{{#var:currentValue}}|{{#vardefine:result|{{#replace:{{{1|}}}|[value]|{{#var:currentValue}}}}}}{{#var:result}}|}}
{{{1|}}}  
 
 
 
 
}}
 
}}
 
<noinclude>[[Category:Sega Retro templates]]
 
<noinclude>[[Category:Sega Retro templates]]
 
 
{{foreach|list=Whoop, gloop, bloop, doop, shoop|delimiter=,|
 
{{foreach|list=Whoop, gloop, bloop, doop, shoop|delimiter=,|
*{{#var:currentValue}}
+
<br/>
 +
*[value]
 
}}
 
}}
 
 
</noinclude>
 
</noinclude>

Revision as of 13:23, 20 November 2017




  • Whoop
  • gloop
  • bloop
  • doop
  • shoop