Skip to main content

Command Palette

Search for a command to run...

zig: Comments

Published
•1 min read•View as Markdown
  • Zig has only single-line comments, but with three variants:

    1. Normal comments:
// This is a comment!
std.debug.print("hello world!",.{}); // This is also a comment!
  1. doc-comments:
/// This function prints 'hello!'
  1. top-level doc comments:
//! This is a top level doc comment.

NOTE:

Normal comments are the ones we beginners can use in any way:

  • to write comments

  • to comment a line of code

But, the other two(doc comments) are special ones for generating docs for packages.

So, don't mess with them for now!