REM statement

Syntax

REM [comment.text]

Description

Use the REM statement to insert a comment in a BASIC program. Comments explain or document various parts of a program. They are part of the source code only and are nonexecutable. They do not affect the size of the object code.

A comment must be a separate BASIC statement, and can appear anywhere in a program. A comment must be one of the following comment designators:

REM * ! $*

Any text that appears between a comment designator and the end of a physical line is treated as part of the comment. If a comment does not fit on one physical line, it can be continued on the next physical line only by starting the new line with a comment designator. If a comment appears at the end of a physical line containing an executable statement, you must treat it as if it were a new statement and put a semicolon ( ; ) after the executable statement, before the comment designator.

Example

PRINT "HI THERE"; REM This part is a comment.
REM This is also a comment and does not print.
REM
IF 5<6 THEN PRINT "YES"; REM A comment; PRINT "PRINT 
ME"
REM BASIC thinks PRINT "PRINT ME" is also part
REM of the comment.
IF 5<6 THEN
   PRINT "YES"; REM Now it doesn't.
   PRINT "PRINT ME"
END

This is the program output:

HI THERE
YES
YES
PRINT ME