0Pricing
Zig Academy · Lesson

Number Literals and Underscores

Write hex, binary, and readable literals.

Writing Numbers Clearly

Zig gives you several ways to write number literals so they read well, no matter which base or size you are working in. ✍️

Decimal Is the Default

A plain number is decimal, base ten, just as you would expect. Nothing extra is needed to write everyday integers.

const score = 1500;

All lessons in this course

  1. Sized Integers: i32, u8, usize
  2. Floating Point: f32 and f64
  3. bool, void, and the Comptime Types
  4. Number Literals and Underscores
← Back to Zig Academy