Previous: , Up: Statements   [Contents][Index]

10.10 Continuation Lines

In the Octave language, most statements end with a newline character and you must tell Octave to ignore the newline character in order to continue a statement from one line to the next. Lines that end with the characters ... are joined with the following line before they are divided into tokens by Octave’s parser. For example, the lines

x = long_variable_name ...
    + longer_variable_name ...
    - 42

form a single statement.

Any text between the continuation marker and the newline character is ignored. For example, the statement

x = long_variable_name ...    # comment one
    + longer_variable_name ...comment two
    - 42                      # last comment

is equivalent to the one shown above.

Inside double-quoted string constants, the character \ has to be used as continuation marker. The \ must appear at the end of the line just before the newline character:

s = "This text starts in the first line \
and is continued in the second line."

Input that occurs inside parentheses can be continued to the next line without having to use a continuation marker. For example, it is possible to write statements like

if (fine_dining_destination == on_a_boat
    || fine_dining_destination == on_a_train)
  seuss (i, will, not, eat, them, sam, i, am, i,
         will, not, eat, green, eggs, and, ham);

without having to add to the clutter with continuation markers.