Line Continuation
Description
By default, a MVBasic program statement can only continue to a second line if it contains a comma. You can specify a line break following a comma. For example:
CRT "Hello",
"World!"
However, by specifying a line continuation character at the end of a line, you can place a line break almost anywhere in a program statement and continue the program statement on the next line.
You must enable a line continuation option in order to use line continuation characters. You can enable either (or both) of the two supported line continuation characters: backslash (\) or vertical bar (|). The following $OPTIONS statements enable these line continuation characters:
$OPTIONS LINE.CONT.BSLASH
$OPTIONS LINE.CONT.VBAR
You can use either or both of these $OPTIONS statements. Like most option statements, you can disable an enabled option by prefacing it with a minus sign. For example $OPTIONS -LINE.CONT.BSLASH.
Once enabled, the specified line continuation character may be used in that MVBasic program. The line continuation character must be the last character in a line. A space or comment is not permitted following a line continuation character. It is recommended that you separate the line continuation character from the preceding characters by a space, though this is not required. You can continue a program statement over any number of lines by specifying a line continuation character at the end of each line.
You can use the backslash character (\) as both a line continuation character and a string quotation character in the same program. For example, the following is valid MVBasic code:
$OPTIONS LINE.CONT.BSLASH
CRT \Hello World! \: \
\It's an "awesome" day\
For clarity of code, it would be preferable to use the vertical bar (|) line continuation character when the backslash is being used as a quotation character. Regardless of which string quotation characters are used, you cannot use a line continuation character within a string.
Emulation
In Caché and most emulations line continuation is disabled by default.
In jBASE emulation, the default is LINE.CONT.BSLASH enabled.
In UniData emulation, the default is LINE.CONT.VBAR enabled.