Skip to main content

Whitespace and Comments

Whitespace and comment indicators.

Whitespace

A whitespace character can be a blank space or a tab. Between command arguments, or between an operator and its operands you can specify no whitespace, one whitespace character, or multiple whitespace characters. For example, the following pairs of statements are functionally identical:

PRINT"fred";!a comment
PRINT   "fred"   ;  ! a comment
PRINT"butter":"fly"
PRINT   "butter"  :   "fly"
PRINT(4=3)+2
PRINT  ( 4 = 3)  +  2 

However, if the first command argument is a number, it must either be quoted, enclosed in parentheses, or separated from the command name by one or more whitespace characters. If the first command argument is a variable, it must either be enclosed in parentheses, or separated from the command name by one or more whitespace characters.

An MVBasic statement can begin in column 1, or can be indented with any number of whitespace characters.

Vertical spacing (line breaks) within a command are only permitted following a comma or following a line continuation character. Refer to the Line Continuation page of this manual for further details.

Comments

A comment is text within a program that is not executed. Comments are used for documenting source code. They do not become part of the executable program and do not affect the size or performance of the object code.

A comment can be on a separate program line, or can follow an executable statement on the same line. A comment can appear after a comma in a command containing a line break. There are three ways to indicate a comment on the same line as executable code: the REM statement, a semicolon asterisk (;*), or a semicolon exclamation mark (;!). When indicating a comment on a separate program line, you can use a dollar sign asterisk ($*), an asterisk (*), or an exclamation point (!), in addition to the REM, ;* and ;! forms. Whitespace is permitted (but optional) before a comment indicator, or between the semicolon and the asterisk or exclamation mark.

All MVBasic comments indicators are single-line comments. You must begin each line of a comment with a comment indicator.

Examples

The following examples are all valid comments:

PRINT TIMEDATE();  ! comment text
  ;! several lines of
  ;! additional comment text
PRINT "Hello",   ;* comment text
;* further comments
      "World!"
PRINT "Hello",  REM comment text
      " World!"
REM  this is a comment
$* comment text

See Also

FeedbackOpens in a new tab