Template:counted range
+
[
0,
)
[edit] The range
template family generate open (x, y), half-open [x, y) (i.e. ranges) or closed [x, y] intervals
See also: Notations for intervals.
{{range|start |end |left=left bracket (optional)|right=right bracket (optional)}} - a range from start to end, the two ends are enclosed in {{c}}. The range is half-open by default, in other words, the default left bracket is [, and the default right bracket is ).
- Example:
{{range|iter|iter + count}}
results in[
iter,
iter + count)
. - Example:
{{range|-32767.0|+32768.0}}
results in[
-32767.0,
+32768.0]
. - Example:
{{range|-65536.0|+65536.0}}
results in(
-65536.0,
+65536.0)
.
{{closed range|start |end }} - a shorthand for {{range|start|end|right=]}}
.
- Example:
{{closed range|-32767.0|+32768.0}}
results in[
-32767.0,
+32768.0]
.
{{open range|start |end }} - a shorthand for {{range|start|end|left=(}}
.
- Example:
{{open range|-1.0|+1.0}}
results in(
-1.0,
+1.0)
.
{{range plain|start |end |left=left bracket (optional)|right=right bracket (optional)}} - a range from start to end, the two ends are enclosed in {{c/core}}. The range is half-open by default, in other words, the default left bracket is [, and the default right bracket is ).
- Example:
{{range plain|/* begin */|/* end */}}
results in[
/* begin */,
/* end */)
. - Example:
{{range plain|'A'|'Z'|]}}
results in[
'A',
'Z')
.
{{closed range plain|start |end }} - a shorthand for {{range plain|start|end|right=]}}
.
- Example:
{{closed range plain|'A'|'Z'}}
results in[
'A',
'Z']
.
{{open range plain|start |end }} - a shorthand for {{range plain|start|end|left=(}}
.
- Example:
{{open range plain|'A'|'Z'}}
results in(
'A',
'Z')
.
{{range/core|start |end |left=left bracket (optional)|right=right bracket (optional)}} - a range from start to end, the two ends are not formatted, so they can be templates. The range is half-open by default, in other words, the default left bracket is [, and the default right bracket is ).
- Example:
{{range/core|{{spar|begin}}|{{spar|end}}}}
results in[
begin,
end)
. - Example:
{{range/core|{{ttb|-128}}|{{ttb|+127}}|]}}
results in[
-128
,
+127
)
.
{{closed range/core|begin |end }} - a shorthand for {{range/core|start|end|right=]}}
.
- Example:
{{closed range/core|{{ttb|-128}}|{{ttb|+127}}}}
results in[
-128
,
+127
]
.
{{open range/core|begin |end }} - a shorthand for {{range/core|start|end|left=(}}
.
- Example:
{{open range/core|{{spar|begin}}|{{spar|end}}}}
results in(
begin,
end)
. - Example:
{{open range/core|{{ttb|-128}}|{{ttb|+127}}|]}}
results in(
-128
,
+127
)
.
[edit] The counted range
template family generate counted ranges x + [0, n)
{{counted range|start |count }} - a range of count elements from start, both arguments are enclosed in {{c}}.
- Example:
{{counted range|iter|count}}
results in iter+
[
0,
count)
.
{{counted range plain|start |count }} - a range of count elements from start, both arguments are enclosed in {{c/core}}.
- Example:
{{counted range plain|iter|count}}
results in iter+
[
0,
count)
.
{{counted range/core|start |count |zero }} - a range of count elements from start, all arguments are not formatted, so they can be templates. zero is used to represent the zero item.
- Example:
{{counted range/core|{{ttb|iter}}|{{ttb|count}}|{{ttb|0}}}}
results initer
+
[
0
,
count
)
. - Example:
{{counted range/core|{{ttb|iter}}|{{ttb|999}}|{{ttb|000}}}}
results initer
+
[
000
,
999
)
.
The above documentation is transcluded from Template:range/doc. (edit | history) Subpages of this template. |