Template:Arraypush
Template documentation
{{arraypush|name of array|item to add to the array}} is used to add an element to the end of an array.
Example
{{ #arraydefine: $cards | Dark Magician, Dark Magician Girl }}The <code>$cards</code> array contains: {{ #arrayprint: $cards }}.
The $cards
array contains: Dark Magician, Dark Magician Girl.
{{ arraypush | $cards | Magician of Black Chaos }}The <code>$cards</code> array now contains: {{ #arrayprint: $cards }}.
The $cards
array now contains: Dark Magician, Dark Magician Girl, Magician of Black Chaos.
Multiple items
To add multiple items to an array at once, use ###
to separate them in the template's input:
{{ arraypush | $cards | Griggle ### Hieracosphinx }}The <code>$cards</code> array now contains: {{ #arrayprint: $cards }}.
The $cards
array now contains: Dark Magician, Dark Magician Girl, Magician of Black Chaos, Griggle, Hieracosphinx.
The delimiter can be changed using the delimiter
parameter:
{{ arraypush | $cards | 7, 7 Completed, 7 Colored Fish | delimiter = , }}The <code>$cards</code> array now contains: {{ #arrayprint: $cards }}.
The $cards
array now contains: Dark Magician, Dark Magician Girl, Magician of Black Chaos, Griggle, Hieracosphinx, 7, 7 Completed, 7 Colored Fish.