Currently there may be errors shown on top of a page, because of a missing Wiki update (PHP version and extension DPL3). |
Navigation
Topics | Help • Register • News • History • How to • Sequences statistics • Template prototypes |
Difference between revisions of "Template:NVal list"
(new first/last options) |
m |
||
Line 19: | Line 19: | ||
{{NVal list|<list>|last}} | {{NVal list|<list>|last}} | ||
</pre> | </pre> | ||
+ | {{NVal list| | ||
+ | 78973 | ||
+ | 341365;71593 | ||
+ | 6660841;118270;C:{{Kbn|74|1024|666084}} | ||
+ | |last}} | ||
[[Category:Prime collections]]</noinclude><includeonly>{{#arraydefine:nvalues|{{{1}}}|/\n/}}{{#switch:{{{2}}} | [[Category:Prime collections]]</noinclude><includeonly>{{#arraydefine:nvalues|{{{1}}}|/\n/}}{{#switch:{{{2}}} | ||
|count={{#arraysize:nvalues}} | |count={{#arraysize:nvalues}} | ||
|short={{#loop:i|0|{{#arraysize:nvalues}}|{{#arraydefine:n2|{{#arrayindex:nvalues|{{#var:i}}}}|;}}{{#ifeq:{{#var:i}}|0||, }}{{#arrayindex:n2|0}}}} | |short={{#loop:i|0|{{#arraysize:nvalues}}|{{#arraydefine:n2|{{#arrayindex:nvalues|{{#var:i}}}}|;}}{{#ifeq:{{#var:i}}|0||, }}{{#arrayindex:n2|0}}}} | ||
− | |first={{#arrayindex:nvalues|0}} | + | |first={{#arraydefine:n2|{{#arrayindex:nvalues|0}}|;}}{{#arrayindex:n2|0}} |
− | |last={{#arrayindex:nvalues|{{#expr:{{#arraysize:nvalues}}-1}}}} | + | |last={{#arraydefine:n2|{{#arrayindex:nvalues|{{#expr:{{#arraysize:nvalues}}-1}}}}|;}}{{#arrayindex:n2|0}} |
|#default={{#loop:i|0|{{#arraysize:nvalues}}|{{#ifeq:{{#var:i}}|0||, }}{{NVal|{{#arrayindex:nvalues|{{#var:i}}}}}}}} | |#default={{#loop:i|0|{{#arraysize:nvalues}}|{{#ifeq:{{#var:i}}|0||, }}{{NVal|{{#arrayindex:nvalues|{{#var:i}}}}}}}} | ||
}}</includeonly> | }}</includeonly> |
Revision as of 08:41, 20 March 2020
Purpose
Displaying a given list of n-values with different options.
Parameter
The first parameter is always the list of n-values, the second can be one of the following:
- <count>: only the number of n-values is displayed
- <short>: only the list of n-values is given without any types/comments
- <first>: returns the first entry of the n-values, empty if none
- <last>: returns the last entry of the n-values, empty if none
- none=default: all n-values with types/comments are displayed
Examples
{{NVal list|<list>}}: default {{NVal list|<list>|count}} {{NVal list|<list>|short}} {{NVal list|<list>|first}} {{NVal list|<list>|last}}
6660841