in BASIC ROM:
|List of all BASIC keywords|
Typ: Command General Programming-Syntax: REM [<text>]
The BASIC command REM is used to place remarks into BASIC-programs. The BASIC interpreter ignores all following text until end of line (even it contains BASIC commands). A program can be enriched with further explanation on how the code works and what variable names and line numbers really means. Blocks of remarks are useful to structure and separate the program and subroutines in visual blocks to make the listing more readable and keep it maintainable. Remarks are also a valuable tool for debugging purposes. Code lines may be commented in and out to quickly select different implementation for a task.
REM will be listed and printed, but this command hasn't got any effect on the program logic. But at least a space penalty is taken into account. Depending on where the remarks are located the performance of the running program may suffer notably.
10 rem Great Comment
10 rem chr$reat lenomment
This effect can be prevented by placing double quotes in front of the text:
10 rem "Great Comment
Other kinds of remarks
In some special constructions allows comments to be placed without using REM. But beware: it is not recommended to use it without a very good reason.
... GOTO linenumber remark text if not starting with a digit
... GOSUB linenumber remark text if not starting with a digit
END : remark text
Typical usage is to guard a subroutine from getting entered by the previous lines. In this case you may place some commentary text afte the END to describe the subroutine. This is impractical if END is used a silent variation of STOP where the program execution may continue right after the END if a CONT command is entered.
10 REM 1ST LINE - IDEA BY JODIGI 2006 20 PRINT "THIS IS THE 2ND LINE" : REM PRINT ON THE SCREEN 30 PRINT X;: X = X + 1: REM LOOP START, COUNTING VARIABLE X 40 IF X < 5 GOTO 30: REM LOOP UNTIL X HITS THE LIMIT 50 END: REM END OF THE MAIN PROGRAM