Rem Statement

Language Items List

Definition:

Used to insert explanatory remarks, or comments, in a program.

Syntax (1):

Rem remark

Syntax (2):

remark

Description:

There are two ways to enter comments in your program: by using the Rem statement, or by using a single quotation mark. The argument remark is the actual text that you want to include as a comment in your program. Spaces and punctuation are valid characters. Using comments to document how your code works or to provide other pertinent information with your code is a good idea when programming.

Syntax 2, shows how you can use a single quotation mark (apostrophe) instead of the Rem reserved word to include comments. You must precede the Rem reserved word with a colon if it follows other statements on a line. When you use a single quotation mark, however, no colon is required.


Note: If you place the Rem statement before specific program instructions, it causes the interpreter to ignore the entire line, which essentially disables it. This technique of temporarily "disabling" a line can be helpful when debugging a program, for example,
Exit Sub , temporarily disables a line of code without removing it.

Be aware of the fact that since a comment essentially causes the rest of a line to be ignored, the following example might be a source of error:

Print 10 : Rem print value : Print is a number

In this case, the second colon is not treated as another statement.