convert_mass()
Learn how to use the convert_mass() function to convert a mass input value from one unit to another.
Convert a mass value from one unit to another.
Syntax
convert_mass(value,from,to)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | real | ✔️ | The value to be converted. |
| from | string | ✔️ | The unit to convert from. For possible values, see Conversion units. |
| to | string | ✔️ | The unit to convert to. For possible values, see Conversion units. |
Conversion units
- Centigram
- Decagram
- Decigram
- EarthMass
- Grain
- Gram
- Hectogram
- Kilogram
- Kilopound
- Kilotonne
- LongHundredweight
- LongTon
- Megapound
- Megatonne
- Microgram
- Milligram
- Nanogram
- Ounce
- Pound
- ShortHundredweight
- ShortTon
- Slug
- SolarMass
- Stone
- Tonne
Returns
Returns the input value converted from one mass unit to another. Invalid units return null.
Example
print result = convert_mass(1.2, 'Kilogram', 'Pound')
Output
| result |
|---|
| 2.64554714621853 |
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.