Available on: all targets

REM

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.

SYNTAX

 REM [comment]
 ' [comment]


Legend
  • id : identifier
  • type : datatype
  • v : value
  • "..." : string
  • [...] : optional

EXAMPLE

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


Any problem?

If you have found a problem with this keyword, if you think there is a bug or, more simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!

open an issue BACK TO KEYWORDS