Mercurial > hg > octave-lyh
changeset 17267:a654c1eccd29
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.
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Thu, 15 Aug 2013 14:38:01 +0200 |
parents | 213ee68b59da |
children | 533c980b5796 |
files | doc/interpreter/stmt.txi |
diffstat | 1 files changed, 22 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/stmt.txi +++ b/doc/interpreter/stmt.txi @@ -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