Difference between revisions of "Template:Interval/doc"

From blackwiki
Jump to navigation Jump to search
imported>Hyacinth
(→‎See also: * {{tl|Infobox Interval}})
imported>Pppery
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 +
{{used in system|in [[Template:ACEWatchlistNotice]], which is used by [[MediaWiki:Watchlist-messages]] when Arbitration Committee elections are taking place}}
 +
{{lua|Module:Interval}}
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
  
Line 5: Line 7:
 
This template determines which interval a given value lies in.
 
This template determines which interval a given value lies in.
  
The intervals are defined by up to 4 unnamed parameters. The value to be determined is named parameter ''n''.
+
The intervals are defined by the unnamed parameters. The value to be determined is named parameter ''n''.
 +
 
 +
<code>format=time</code> can also be passed to the template. If set, the intervals and value will be compared as times (and if n is not provided, it will evaluate as the current timestamp).
  
 
=== Examples ===
 
=== Examples ===
Line 19: Line 23:
 
*{{tlx|Interval|2=n=5|3=2|4=4|5=6}} gives {{Interval|n=5|2|4|6}} because 5 is in the interval between the 2nd and 3rd values.
 
*{{tlx|Interval|2=n=5|3=2|4=4|5=6}} gives {{Interval|n=5|2|4|6}} because 5 is in the interval between the 2nd and 3rd values.
 
*{{tlx|Interval|2=n=6|3=2|4=4|5=6}} gives {{Interval|n=6|2|4|6}} because 6 is in the interval between the 3rd and 4th values.
 
*{{tlx|Interval|2=n=6|3=2|4=4|5=6}} gives {{Interval|n=6|2|4|6}} because 6 is in the interval between the 3rd and 4th values.
 +
 +
==== Time ====
 +
* {{tlx|interval|3=14 October|4=24 October|5=29 October|6=7 December|7=format=time}} produces {{interval|14 October|24 October|29 October|7 December|format=time}}
  
 
=== See also ===
 
=== See also ===
 
* [[Template:Intervals]], a navbox about [[Interval (music)|musical intervals]].
 
* [[Template:Intervals]], a navbox about [[Interval (music)|musical intervals]].
 
* {{tl|Infobox Interval}}
 
* {{tl|Infobox Interval}}
<includeonly>
+
 
 +
<includeonly>{{Sandbox other||
 +
 
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
[[Category:Boolean, register, and condition testing templates]]
 
[[Category:Boolean, register, and condition testing templates]]
  
</includeonly>
+
}}</includeonly>

Latest revision as of 03:52, 24 September 2020

Usage

This template determines which interval a given value lies in.

The intervals are defined by the unnamed parameters. The value to be determined is named parameter n.

format=time can also be passed to the template. If set, the intervals and value will be compared as times (and if n is not provided, it will evaluate as the current timestamp).

Examples

Passing 2, 4 and 6 as the unnamed parameters defines the following intervals:

  • -∞<x<2
  • 2≤x<4
  • 4≤x<6
  • 6≤x<∞

Then:

  • {{Interval|n=1|2|4|6}} gives 0-1 because 1 is in the interval between the 0th and 1st values.
  • {{Interval|n=4|2|4|6}} gives 2-3 because 4 is in the interval between the 2nd and 3rd values.
  • {{Interval|n=5|2|4|6}} gives 2-3 because 5 is in the interval between the 2nd and 3rd values.
  • {{Interval|n=6|2|4|6}} gives 3-4 because 6 is in the interval between the 3rd and 4th values.

Time

  • {{interval|14 October|24 October|29 October|7 December|format=time}} produces 4-5

See also