How do I comment q code?

A till-end-of-line comment begins with a single slash that appears either –

  1. at the start of a non-empty line,
/ this line is ignored
/so is this one


  1. is preceded by a space:
foo: 47;      / this is also a comment
42+/1 2 3     / The first / does NOT start a comment!

In the last example, the first slash functions as the adverb over.

Begin a block comment with a lone backslash at the start of a line, and finish it with sole slash –

All of this is a block comment.
Even /\ this is OK.
x: 47              / this line (before the slash) is code

or the reverse:

The opposite works, too.
Using block comments to comment out code can be
confusing unless you pick one way and stick to it.

A \ does not have to be matched; it then serves as an end-of-file indicator:

all lines below are

Lastly, if a script’s first line begins with ‘#!’, that line is skipped, e.g.:

#! blah.. blah..