Q(uick)BASIC Statement: REM
Quick View
REM
A BASIC declaration that allows explanatory remarks to be inserted in a program
Worth knowing
Useful and cross-version information about the programming environments of QBasic and QuickBasic.
Syntax
- REM remark
- ' remark
Description/Parameter(s)
remark | Any text. |
- Remarks are ignored when the program runs unless they contain metacommands.
- A remark can be inserted on a line after an executable statement if it is preceded by the single-quote (') form of REM or if REM is preceded by a colon (:).
Example
REM This is a comment.
' This is also a comment.
PRINT "Test1" 'This is a comment after a PRINT statement.
PRINT "Test2" : REM This is also a comment after a PRINT statement.
See also:
Syntax
- REM remark
- ' remark
Description/Parameter(s)
- remark is any explanation you think will be useful to a reader of the program text, and which will fit on the rest of the program line
REM statements are not compiled, but they appear exactly as entered when the program is listed.
You may branch from a GOTO or GOSUB statement to a REM statement. Execution continues with the first executable statement after the REM statement.
A single quotation mark can be used instead of the REM keyword.
If the REM keyword follows other statements on a line, it must be separated from the statements by a colon.
REM statements are also used to introduce metacommands.
Note: | Do not use the single quotation form of the REM statement in a DATA statement because it will be considered valid data. |
Example
This example shows two equivalent remark statements. Note that you must precede a REM statement at the end of a line with a colon.
Note: This is not a complete program. Do not run this example in its current form.
FOR I = 1 TO 23 : Array(I) = 1 : NEXT I : REM Initialize the array.
FOR I = 1 TO 23 : Array(I) = 1 : NEXT I ' Initialize the array.
Syntax
- REM remark
- ' remark
Description/Parameter(s)
remark | Any explanation you think will be useful to a reader of the program text, and which will fit on the rest of the program line. Remarks also may be on a separate line or lines. |
- A single quotation mark can be used instead of the REM keyword.
- If the REM keyword follows other statements on a line, it must be separated from the statements by a colon.
Usage Notes
- REM statements are not compiled, but they appear exactly as entered when the program is listed.
- You may branch from a GOTO or GOSUB statement to a REM statement. Execution continues with the first executable statement after the REM statement.
- REM statements also are used to introduce metacommands (see ⮜ Metacommand Syntax ⮞)
- Do not use the single quotation form of the REM statement in a DATA statement because it will be considered valid data.
Example
This example shows two equivalent remark statements.
Note that you must precede a REM statement at the end of a line with 'a colon.
DIM Array(23)
FOR I = 1 TO 23: Array(I) = 1: NEXT I: REM Initialize the array.
FOR I = 1 TO 23: Array(I) = 1: NEXT I 'Initialize the array.
See also: