Difference between revisions of "Template:Convert"

From Teampedia
Jump to: navigation, search
Line 3: Line 3:
 
=Examples=
 
=Examples=
 
==Ex 1==
 
==Ex 1==
<div style="width: 400px; font-size:125%;"><pre>
 
* '''Mile''': {{convert|mi|5}}
 
<div style="width: 400px; font-size:125%;"><pre>
 
Produces:
 
* '''Weight''': {{convert|kg|5}}
 
</pre></div>
 
==Ex 2==
 
 
<div style="width: 400px; font-size:125%;"><pre>
 
<div style="width: 400px; font-size:125%;"><pre>
 
* '''Weight''': {{convert|kg|5}}
 
* '''Weight''': {{convert|kg|5}}
Line 15: Line 8:
 
Produces:
 
Produces:
 
* '''Weight''': {{convert|kg|5}}
 
* '''Weight''': {{convert|kg|5}}
==Ex 3==
+
==Ex 2==
 
<div style="width: 400px; font-size:125%;"><pre>
 
<div style="width: 400px; font-size:125%;"><pre>
 
* '''Weight''': {{convert|oz|25}}
 
* '''Weight''': {{convert|oz|25}}
Line 21: Line 14:
 
Produces:
 
Produces:
 
* '''Weight''': {{convert|oz|25}}
 
* '''Weight''': {{convert|oz|25}}
==Ex 4==
+
==Ex 3==
 
<div style="width: 400px; font-size:125%;"><pre>
 
<div style="width: 400px; font-size:125%;"><pre>
 
* '''Barrel Length''': {{convert|in|5}}
 
* '''Barrel Length''': {{convert|in|5}}
Line 27: Line 20:
 
Produces:
 
Produces:
 
* '''Barrel Length''': {{convert|in|5}}
 
* '''Barrel Length''': {{convert|in|5}}
==Ex 5==
+
==Ex 4==
 
<div style="width: 400px; font-size:125%;"><pre>
 
<div style="width: 400px; font-size:125%;"><pre>
 
* '''Barrel Length''': {{convert|cm|25.1}}
 
* '''Barrel Length''': {{convert|cm|25.1}}
Line 34: Line 27:
 
* '''Barrel Length''': {{convert|cm|25.1}}
 
* '''Barrel Length''': {{convert|cm|25.1}}
  
==Ex 6==
+
==Ex 5==
 
If the parameter supplied is invalid (such as '''ccm''' no output will be displayed)
 
If the parameter supplied is invalid (such as '''ccm''' no output will be displayed)
 
<div style="width: 400px; font-size:125%;"><pre>
 
<div style="width: 400px; font-size:125%;"><pre>

Revision as of 00:56, 1 March 2020

This tempalte allows for an easy way to convert units. To use the template place {{convert|Value 1|Value 2}} The first value given to the template, indicates what unit you are supplying (acceptable values are kg, lbs, g, oz, in, cm, mm). The Second parameter is the value you want to convert.

Examples

Ex 1

* '''Weight''': {{convert|kg|5}}

Produces:

  • Weight: kg  (Expression error: Unrecognized word "kg". )

Ex 2

* '''Weight''': {{convert|oz|25}}

Produces:

  • Weight: oz  (Expression error: Unrecognized word "oz". )

Ex 3

* '''Barrel Length''': {{convert|in|5}}

Produces:

  • Barrel Length: in  (Expression error: Unrecognized word "in". )

Ex 4

* '''Barrel Length''': {{convert|cm|25.1}}

Produces:

  • Barrel Length: cm  (Expression error: Unrecognized word "cm". )

Ex 5

If the parameter supplied is invalid (such as ccm no output will be displayed)

* '''Barrel Length''': {{convert|ccm|25}}

Produces:

  • Barrel Length: ccm  (Expression error: Unrecognized word "ccm". )