Template:Count: Difference between revisions

From The Pokemon Insurgence Wiki
No edit summary
No edit summary
 
Line 1: Line 1:
 
<!-- ■■ Add categories to the bottom of the documentation page. ■■ --><!--
 
    ■► NOTE: Update [[Template:Count/doc]] and [[Template:Count/testcases]] if support is added for more parameters. ◄■ 
Returns a number from (0 or 1) to 10 indicating the number of '''defined''' parameters passed.&nbsp; Currently supports a '''maximum of 10 parameters'''.
--><includeonly>{{#expr:{{#if:{{{1|}}}|1|0}}+{{#if:{{{2|}}}|1|0}}+{{#if:{{{3|}}}|1|0}}+{{#if:{{{4|}}}|1|0}}+{{#if:{{{5|}}}|1|0}}+{{#if:{{{6|}}}|1|0}}+{{#if:{{{7|}}}|1|0}}+{{#if:{{{8|}}}|1|0}}+{{#if:{{{9|}}}|1|0}}+{{#if:{{{10|}}}|1|0}}+{{#if:{{{1|}}}{{{2|}}}{{{3|}}}{{{4|}}}{{{5|}}}{{{6|}}}{{{7|}}}{{{8|}}}{{{9|}}}{{{10|}}}|0|{{{base|0}}}}}}}</includeonly><noinclude>{{documentation}}</noinclude>
 
 
</noinclude>

Latest revision as of 22:21, 29 January 2015

Template documentation follows
Note: the template above may sometimes be partially or fully invisible.
Visit Template:Count/doc to edit this documentation. (How does this work?)

Returns a number from (0 or 1) to 10 indicating the number of defined parameters passed.  Currently supports a maximum of 10 parameters.

Usage

Set base=0 or base=1 to change from the default value returned if there are no defined parameters.  (i.e. If no defined parameters, returns 0 by default (or 1 if base=1))

Examples

Note: {{Count/testcase1}} tests nesting of templates calling {{Count}}.

Call Result
{{Count|A|B||D}} 3
{{Count/testcase1}} 0
{{Count/testcase1|base{{=}}1}} 1
{{Count/testcase1|base{{=}}0}} 0
{{Count/testcase1|abc}} 1
{{Count/testcase1|abc|base{{=}}0}} 1
{{Count/testcase1|abc|base{{=}}1}} 1
{{Count/testcase1||DEF}} 1
{{Count/testcase1|abc|DEF}} 2
{{Count/testcase1|abc|DEF|}} 2
{{Count/testcase1|abc|DEF|ghi}} 3
{{Count/testcase1|abc||ghi}} 2
{{Count/testcase1|abc|DEF|ghi|JKL|mno|PQR|stu|VWX|yz#}} 9
{{Count/testcase1|abc|DEF|ghi|JKL|mno|PQR|stu|VWX|yz@|#$%}} 10
{{Count/testcase1|abc|DEF|ghi|JKL|mno|PQR|stu|VWX|yz@|#$%|^&*|()_|+:"|123|456|789|000}} 10   Only counts to 10 right now!
{{Count/testcase1|abc||ghi||mno||stu||yz@|}} 5
{{Count/testcase1||DEF||JKL||PQR||VWX||#$%}} 5
{{Count/testcase1|DEF|JKL|PQR|VWX|#$%}} 5
{{Count/testcase1||||||||||#$%}} 1
{{Count/testcase1|||||||||}} 0
{{Count/testcase1||||||||||base{{=}}0}} 0
{{Count/testcase1||||||||||base{{=}}1}} 1
{{Count/testcase1|base{{=}}0|||||||||}} 0
{{Count/testcase1|base{{=}}1|||||||||}} 1
{{Count/testcase1|base{{=}}0||||||PQR|||}} 1
{{Count/testcase1|base{{=}}1||||||PQR|||}} 1

See also