REM Statements

Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n1 (Volume 2, Issue 1)
Date: January 1981
Pages: 10, 12

REM statements can be useful tools for beginning programmers. REM stands for REMark. You can also think of it as REMinder or REMember.

The computer does not execute REM statements. It will ignore anything you write after REM in any line. Use REM to write notes to yourself about the functions of various parts of your program. For example, if you wrote a program that asked for data, performed a computation, then displayed the results, you could insert REM statements delineating these parts:

 10 REM THIS PROGRAM CALCULATES AVERAGE INCOME FOR 10 YEARS.
20 REM NEED 10 YEARLY INCOME FIGURES.

The next lines would print requests for yearly incomes and input that information. Then you get to the calculation:

100 REM NOW CALCULATE AVERAGE

The next lines tell the computer to add the incomes and divide by the number of years.

Finally, you want to see the results:

150 REM PRINT ANSWER

The next line is a print statement to tabulate the average yearly income.

This trick is especially useful to remind yourself what you wanted to do at each step of your program. It also helps others who might try to debug a program that won’t run or adapt one you wrote.

You can also use REM statements to include copyright notices in programs you write, or to insert disclaimers of responsibility, as for games like rolling dice that may be used for gambling. I don’t know if this constitutes legal protection, but it does make your intent clear.