« What does '\l .' or 'system “l ."' do? | Main | Can a historical database be partitioned on multiple levels - say, by date, then symbol? »

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


2. 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..

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
All HTML will be escaped. Textile formatting is allowed.