A script must always start with a comment. A comment is simply a /* followed by a space, and then */. You can optionally put any desired text inbetween the /* and */. This opening comment must be the very first thing in the text file (although blank spaces and blank lines may precede it). The opening comment is used by REXX to verify that this is indeed a REXX script, and not just some arbitrary text file.

Note: Most modern interpreters have relaxed this rule, and do not require that your REXX script start with a comment. For example, Reginald does not require this.

A comment can span any number of lines, and have any amount of text inside of it. REXX simply ignores everything inbetween the /* and */.

Here's an example of a comment:

/* REXX ignores all of this text. */

You may nest comments (ie, put a comment inside of another comment). But you need to make certain that for every /* there is a matching */ afterward.

Here's an example of a comment inside of another comment:

/* Here's some text...
/* Here's a comment inside of another comment. */
... that the interpreter ignores. */

Note: Some very old interpreters may not support nested comments, and will either misinterpret part of the comment as other REXX statements, or raise a SYNTAX error.

You can place a comment anywhere you'd like, but be careful of doing something like trying to put a comment inbetween some variable's name. (We'll get to variables soon). For example, assume that you have the compound variable MyVar.MyTail and you try to put a comment as so:

MyVar./* My Comment */MyTail

Above, you've effectively split the variable name into two separate variable names, although the above REXX statement is legal.

A good, and generally safe, place to put a comment is at the end of a line, to comment that particular line. Alternately, you can put a comment on its own lines (although this may cause REXX to use a little more memory than the preceding suggestion).