Skip to content

Comments

Comments in Zolo serve to explain intent, temporarily disable code, and visually organize long sections. There are two styles: line (//) and block (/* */).

A line comment starts at // and runs to the end of the line. It is the most common style for short annotations alongside code:

Line, block, and nested block comments; visual separators with --; TODO/FIXME/NOTE/HACK/SAFETY conventions.

01-comments.zolo
// ============================================================

// Comments in Zolo

// ============================================================

// -- Line comments --------------------------------------------

// This is a simple line comment.

// Everything after // until the end of line is ignored by the compiler.

let x = 42
// trailing comment at end of line

// You can use comments to disable code:

// let debug = true

// print("debug mode active")

// -- Block comments -------------------------------------------

/* This is a block comment.
   It can span multiple lines.
   Useful for describing large sections of code. */
let y = 10
/* inline value */
/* Block comments can be nested:
   /* this is a block inside another block */
   and this is still part of the outer comment
*/
// -- Visual sections with comments ----------------------------

// Use decorative lines to separate sections of code:

// -- Constants -------------------------------

const PI = 3.14159
const MAX_RETRIES = 3

// -- Helper functions ------------------------

fn helper(x: int) -> int {
    return x * 2
}

// -- Main logic ------------------------------

let result = helper(21)
print("Result: {result}")

// -- TODO / FIXME / NOTE --------------------------------------

// Common conventions in comments:

// TODO: implement input validation

// FIXME: this function does not handle negative values

// NOTE: this algorithm has O(n^2) complexity

// HACK: temporary workaround until the parser is fixed

// SAFETY: safe call because we validated bounds above

fn sum(a: int, b: int) -> int {
    // TODO: add overflow check

    return a + b
}

print("sum: {sum(10, 20)}")

Requires the Zolo CLI/host — open in the playground or run locally.

/* */ blocks can be nested — opening a block inside another is still part of the outer comment. This makes it easy to comment out sections that already contain inner comments without breaking anything.

The markers TODO, FIXME, NOTE, and HACK are conventions widely recognized by editors and static analysis tools. Use them to flag pending work and deliberate decisions.

Challenge

Add a // TODO: comment to a function in the example and use the visual separator // -- Name ------ to organize the file into sections. Notice how readability improves with comment structure alone.

See also

enespt-br