# HG changeset patch # User Stefan Mahr # Date 1376570281 -7200 # Node ID a654c1eccd294d992d0755796fb66562238ad554 # Parent 213ee68b59dac9c8a6a79b25798e66512a102eaa doc: Modify chapter 'continuation lines' to fit actual behaviour * doc/interpreter/stmt.txi: Change the description of continuation lines, since \ is deprecated as continuation marker for statements. Add description of line continuation for double-quoted strings. diff -r 213ee68b59da -r a654c1eccd29 doc/interpreter/stmt.txi --- a/doc/interpreter/stmt.txi Thu Aug 15 20:14:30 2013 +0200 +++ b/doc/interpreter/stmt.txi Thu Aug 15 14:38:01 2013 +0200 @@ -860,40 +860,46 @@ 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 @code{...} or @code{\} are joined with the following line -before they are divided into tokens by Octave's parser. For example, -the lines +characters @code{...} are joined with the following line before they are +divided into tokens by Octave's parser. For example, the lines @example @group x = long_variable_name ... - + longer_variable_name \ + + longer_variable_name ... - 42 @end group @end example @noindent -form a single statement. The backslash character on the second line -above is interpreted as a continuation character, @emph{not} as a division -operator. +form a single statement. -For continuation lines that do not occur inside string constants, -whitespace and comments may appear between the continuation marker and -the newline character. For example, the statement +Any text between the continuation marker and the newline character is +ignored. For example, the statement @example @group -x = long_variable_name ... # comment one - + longer_variable_name \ # comment two - - 42 # last comment +x = long_variable_name ... # comment one + + longer_variable_name ...comment two + - 42 # last comment @end group @end example @noindent -is equivalent to the one shown above. Inside string constants, the -continuation marker must appear at the end of the line just before the -newline character. +is equivalent to the one shown above. + +Inside double-quoted string constants, the character @code{\} has to be +used as continuation marker. The @code{\} must appear at the end of the +line just before the newline character: +@example +@group +s = "This text starts in the first line \ +and is continued in the second line." +@end group +@end example + +@noindent 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