Template:Item: Difference between revisions

From Mediawiki1
Jump to navigationJump to search
No edit summary
No edit summary
Line 6: Line 6:
* '''<nowiki>{{get|a,b,c,d|1}}</nowiki>''' results in '''b'''
* '''<nowiki>{{get|a,b,c,d|1}}</nowiki>''' results in '''b'''
* '''<nowiki>{{get|a,b,c,d|-2}}</nowiki>''' results in '''c'''
* '''<nowiki>{{get|a,b,c,d|-2}}</nowiki>''' results in '''c'''
Also check out the [[Template:Get/test|tests]].
</noinclude>
</noinclude>

Revision as of 07:00, 15 March 2012

Gets an item from a list. The first parameter is the list - a string containing items separated by commas. The second parameter is the zero-based index of the item. Negative indexes start from the end of the list.

Examples:

  • {{get|a,b,c,d|1}} results in b
  • {{get|a,b,c,d|-2}} results in c

Also check out the tests.