Units of measure

Numbers often relate to some unit, such as metres, dollars, grams, items sold, and so on. Units of measure allow you to track which units a number is measured in, which can help you to remember the units, and also check that two numbers with different units are not compared (e.g. comparing centimetres to metres, or dollars to euros).

How to start using units

Units are written after the Number type in curly brackets. How to add units depends on the context:

Several units are built-in to the software, such as m (metres), s (seconds), year, USD (US dollars) and more.

More details

Units can be multiplied together or divided, for example speed might use the unit {m/s} (metres per second) and acceleration might be {m/s^2}. These units are tracked when you multiply or divide, so 10{m} / 4{s} gives 2.5{m/s}, and 30{USD}/2{hour} gives 15{USD/hour}.

Many numeric functions work on numbers with units, and preserve them, e.g. abs(-1{hour}) will give back 1{hour}.

For information on converting between units, see the conversion guide.