Back to course

Formatting and Printing

Full Course: Zig Programming From Zero to Hero

Formatting strings

Zig uses {} as placeholders. You can specify formatting options inside the braces.

  • {d}: decimal
  • {s}: string
  • {x}: hexadecimal
  • {any}: automatically guess format

zig std.debug.print("Value: {d}, Hex: {x}\n", .{ 255, 255 });