Syntax
Marks text that the compiler ignores. Six forms exist: four line comments and two block comments.
<code> ' <text>
<code> // <text>
REM <text>
<code> ` <text>
REMSTART
<lines>
REMEND
/* <lines> */Also written : ', REM, //, `, REMSTART, REMEND, /*, */
Parts
| <code> | An optional statement before the comment on the same line. |
|---|---|
| <text> | The comment, up to the end of the line. |
| <lines> | Any number of lines of comment. |
Good to know
- Use
'or//. They are the only two forms that are safe everywhere. The other four exist so that code from other dialects keeps compiling. - A
:inside a REM or backtick comment splits the line:x = 1 REM note: morecompilesmoreas code and fails with "Not a BASIC statement". A full-line REM is safe; a REM after a statement is not. REMSTART,REMENDand/*must start their line. Everything on the line of/*is comment, and so is the rest of the line after*/: code written there never runs.- A line inside a block comment must not start with one word followed by
:.TODO: tidyis read as a label, and the program is refused with "BASIC label TODO requires RETURN". - A block that is never closed is an error: "REMSTART requires REMEND" or "/* requires */".
;is not a comment: the text after it is compiled as code.
Example
' A full-line comment// Another full-line commentx = 1 ' after a statementy = 2 // after a statement tooREMSTARTA block of notesover several linesREMEND/* A C-style block over several lines */Console(Str(x + y)) ' 3In the manual : Program structure