Splitting Long Statements over Multiple Lines

While writing code in ViviFire, you will occasionally write a line of code that is long enough to go off the edge of the screen. When this happens, you can split the line into two or more lines by using the line continuation character.

The underscore (_) can be placed at the end of a line where you want the statement to be broken. Although not a requirement, it is a good practice to leave some whitespace before the underscore.

The following code demonstrates how a long statement could be split into three lines.

Listing
#Debug "Manufacturer = " & Manufacturer & _
   $N "Model = " & Model & _
   $N "Price = " & Price

The line continuation character is usually the last character on a line. However, you can follow it with whitespace, which can include a comment. If you must comment, the inline form (i.e. the form beginning with an apostrophe (')) is best for readability.

There are some limitations on where you can place the line continuation character. You cannot break a token, such as an identifier, for example. Another place to avoid is between a name and a left parenthesis, such as with arrays and procedures.

You cannot break a comment with a line continuation. Inside a comment, the underscore character is seen the same as any letter or digit. If you need a multiline comment, either use repeated inline comments or use a block comment.

See also