0Pricing
Zig Academy · Lesson

zig fmt: Format Your Code

Keep code tidy with the built-in formatter.

One Canonical Style

Zig ships a built-in formatter so every project looks the same. The command zig fmt rewrites your code into the canonical Zig style.

Format a File in Place

Point zig fmt at a file and it reformats that file directly on disk, fixing indentation, spacing, and line breaks for you.

zig fmt main.zig

All lessons in this course

  1. zig run vs zig build-exe
  2. Debug, ReleaseSafe, ReleaseFast
  3. Reading Compiler Errors
  4. zig fmt: Format Your Code
← Back to Zig Academy