Difference between revisions of "User:Trang Oul/Sandbox/Template:Range/Unsigned"

From Basin Wiki
Jump to navigation Jump to search
(Undo revision 70581 by Trang Oul (talk))
Tag: Undo
Line 1: Line 1:
 +
 
<noinclude>
 
<noinclude>
−
Usage: <code><nowiki>{{Range/Unsigned|min|max}}</nowiki></code>
+
== Usage ==
 +
 
 +
<code><nowiki>{{Range/Unsigned|min|max}}</nowiki></code>
 +
 
 +
The template displays an unsigned range using a hyphen as the separator. Negative boundaries are enclosed in parentheses to avoid ambiguity.
 +
 
 +
== Parameters ==
 +
 
 +
{| class="wikitable"
 +
! Parameter
 +
! Description
 +
! Default
 +
|-
 +
| <code>1</code> (<code>min</code>)
 +
| The lower bound of the range.
 +
|
 +
|-
 +
| <code>2</code> (<code>max</code>)
 +
| The upper bound of the range.
 +
|
 +
|}
 +
 
 +
== Behavior ==
 +
 
 +
* Both parameters are displayed as a range separated by a hyphen.
 +
* Negative values are enclosed in parentheses.
 +
* Non-negative values are displayed without additional parentheses.
 +
* The template does not add explicit positive signs.
 +
 
 +
== Examples ==
 +
 
 +
{| class="wikitable"
 +
! Input
 +
! Result
 +
! Description
 +
|-
 +
| <code><nowiki>{{Range/Unsigned|1|2}}</nowiki></code>
 +
| {{User:Trang Oul/Sandbox/Template:Range/Unsigned|1|2}}
 +
| Positive range
 +
|-
 +
| <code><nowiki>{{Range/Unsigned|0|2}}</nowiki></code>
 +
| {{User:Trang Oul/Sandbox/Template:Range/Unsigned|0|2}}
 +
| Range starting at zero
 +
|-
 +
| <code><nowiki>{{Range/Unsigned|-1|2}}</nowiki></code>
 +
| {{User:Trang Oul/Sandbox/Template:Range/Unsigned|-1|2}}
 +
| Negative minimum and positive maximum
 +
|-
 +
| <code><nowiki>{{Range/Unsigned|-1|0}}</nowiki></code>
 +
| {{User:Trang Oul/Sandbox/Template:Range/Unsigned|-1|0}}
 +
| Negative minimum and zero maximum
 +
|-
 +
| <code><nowiki>{{Range/Unsigned|-2|-1}}</nowiki></code>
 +
| {{User:Trang Oul/Sandbox/Template:Range/Unsigned|-2|-1}}
 +
| Negative range
 +
|}
  
−
Examples:
 
−
* ++: {{User:Trang Oul/Sandbox/Template:Range/Unsigned|1|2}}
 
−
* 0+: {{User:Trang Oul/Sandbox/Template:Range/Unsigned|0|2}}
 
−
* -+: {{User:Trang Oul/Sandbox/Template:Range/Unsigned|-1|2}}
 
−
* -0: {{User:Trang Oul/Sandbox/Template:Range/Unsigned|-1|0}}
 
−
* --: {{User:Trang Oul/Sandbox/Template:Range/Unsigned|-2|-1}}
 
 
</noinclude><includeonly>({{#ifexpr: {{{1}}} < 0 | ({{{1}}}) | {{{1}}} }}-{{#ifexpr: {{{2}}} < 0 | ({{{2}}}) | {{{2}}} }})</includeonly>
 
</noinclude><includeonly>({{#ifexpr: {{{1}}} < 0 | ({{{1}}}) | {{{1}}} }}-{{#ifexpr: {{{2}}} < 0 | ({{{2}}}) | {{{2}}} }})</includeonly>

Revision as of 19:42, 4 November 2026


Usage

{{Range/Unsigned|min|max}}

The template displays an unsigned range using a hyphen as the separator. Negative boundaries are enclosed in parentheses to avoid ambiguity.

Parameters

Parameter Description Default
1 (min) The lower bound of the range.
2 (max) The upper bound of the range.

Behavior

  • Both parameters are displayed as a range separated by a hyphen.
  • Negative values are enclosed in parentheses.
  • Non-negative values are displayed without additional parentheses.
  • The template does not add explicit positive signs.

Examples

Input Result Description
{{Range/Unsigned|1|2}}

(1-2)

Positive range
{{Range/Unsigned|0|2}}

(0-2)

Range starting at zero
{{Range/Unsigned|-1|2}}

((-1)-2)

Negative minimum and positive maximum
{{Range/Unsigned|-1|0}}

((-1)-0)

Negative minimum and zero maximum
{{Range/Unsigned|-2|-1}}

((-2)-(-1))

Negative range