Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Quantity Operators

Quantity types support most operators which primitive types do. See section operators in expressions for a complete list

The only difference about quantity operators is, that they calculate units too, where units remain flexible.

test

use std::debug::assert_eq;

assert_eq([6cm * 2cm, 12cm²]);
assert_eq([6cm / 2cm, 3.0]);
assert_eq([6cm + 2cm, 80mm]);
assert_eq([6cm - 2cm, 0.04m]);