Template:N/doc

From Moegirlpedia
< Template:N
Revision as of 09:35, 10 January 2021 by GuoPC (talk | contribs) (New template document)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

This template is a self incrementing counter.

It is better not to use this template in function templates, otherwise it may cause confusion in the counter id saved by this template.

Please refer to {{counter}} or {{iCounter}} for template counters.

Usage

1. Initialization

{{n|init=1|id=an id, unique, "n.default" as default}}

{{n|init}}         <!-- This form with default value 1 -->

Must be initialized before use, the initialization will output the passed value of parameter "init".

2. Using

{{n|id=counter id, last called id as default; if omitted id when initializing, "n.default" as default}}
{{n|noecho}}       <!-- Increase the count without output -->

Examples

Example 1

{{n|init}}
{{n}}
{{n}}

{{n|init=10}}
{{n}}
{{n}}

1 2 3

10 11 12

Example 2

{{n|init=100|id=hundred}}
{{n}}
{{n}}

{{n|init|id=one}}
{{n}}
{{n}}

{{n|id=hundred}}
{{n}}
{{n}}

100 101 102

1 2 3

103 104 105

See also

  • {{iCounter}} (counter meta template)
  • {{counter}} (mainly for generating unique sequence number)
  • {{c}} (for anonymous #forargs parameter)
  • {{n}} (counters in articles)