Table of Contents

ugBASIC User Manual

REM

SYNTAX

   REM [comment]
   ' [comment]

PURPOSE

In BASIC, the REM keyword (also abbreviated by the single quotation character (')) is used to insert comments into code. A comment is a note or explanation that is added to code to make it easier for the developer to understand, as well as for other programmers who may read it in the future.

When the computer compile the ugBASIC program, it completely ignores everything that follows the REM keyword on the same line. The word REM can be placed at the beginning of a line or after a colon. In either case, the rest of the line will be treated as a comment. To comment out multiple lines of code, you can use REM at the beginning of each line. Note that you cannot continue a REM statement by using a line-continuation sequence (_). This means that, for a multiple-line comment, you need to use as many REMs statements as the lines you comment.

Comments have the role to describe the purpose of a particular section of code or individual statement, and it provide information about the program, who created it, when it was created, and what changes were made. They make code easier to understand, even for people who didn write the program: when you return to code after some time, comments help you remember the purpose of different parts of the program.

Moreover, it is the best way to disable a piece of code without deleting it, simply add REM to the beginning of the line.

The main guidelines in using REM it to use simple, direct language to explain the code, avoiding long or complicated sentences. Generally, they should be used on parts of the code that are not obvious. You do not need to comment on every single line.

EXAMPLE

  REM this is a comment
  ' and this is a comment
  PRINT "ok": REM I am printing ok

AVAILABLE ON

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY