zig: Comments

csmcsm
1 min read
  • 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!

0
Subscribe to my newsletter

Read articles from csm directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

csm
csm