Numbers and booleans

Integers are decimal by default and may use 0x, 0b, or 0o prefixes. Underscores group digits without changing the value. A decimal point or exponent makes a float. Booleans are true and false.

Plain integer and float literals infer int and float; a surrounding type can select a narrower numeric representation.

fn main() {
  println(0xFF | 0b1010)
  println(0o755)
  println(1_000)
  println(1.5e2 > 100.0)
}
Output & diagnostics
Expected:
255
493
1000
true
Ctrl/⌘+Enter runs the current lesson.