// Single-line comments

Allows you to add explanatory text to code. The comment begins with a double slash (//) and ends at a newline character (\n), a carriage return (\r), or the end of the file.

Syntax

// comment
comment
Descriptive text.
Note: Comments can be nested.

Examples

This example uses a comment to document a procedure modification:

// Procedure written  9/5/87 by CHC
//           revised  9/27/87 by DG

FOR EACH Customer NO-LOCK:
  DISPLAY Customer.CustNum Customer.Name Customer.Contact Customer.Phone.
END.

To be properly interpreted as the beginning of a single-line comment, the "//" must be preceded by a line break or whitespace. In the first line of code below, the text between "//" and the end of the line will be interpreted as a comment, but it will not in the second line:

RUN r-upord.p. // Update customer's orders

RUN r-upord.p.// Update customer's orders
Caution:
If you need to use // at the beginning of a pathname, such as in RUN //dir1/file, the pathname will be interpreted as a comment because the // is preceded by a space. Enclosing the pathname in quotes ensures that the text following // will not be treated as a comment. Pathnames that contain // in their interior, such as in RUN parent//dir1/file, will work as expected.

Both multi-line comments and single-line comments can be nested inside a single-line comment.

See also

/* Multi-line comments */