integer
| Length | Signed | Unsigned |
|---|---|---|
| 8-bit | i8 | u8 |
| 16-bit | i16 | u16 |
| 32-bit | i32 | u32 |
| 64-bit | i64 | u64 |
| 128-bit | i128 | u128 |
| arch | isize | usize |
floating-point types
let x = 2.0; // f64 by default
let x: f32 = 3.0; // f32
Numeric Operations
addition:
let sum = 5 + 10;
subtraction:
let difference = 95.5 - 4.3;
multiplication:
let product = 4 * 30;
division:
let quotient = 56.7 / 32.2
let truncated = -5 / 3; // Result in -1
remainder:
let remainder = 43 % 5;
The Boolean Type
let t = true;
let f: bool = false; // with explicit type annotation