From help-request at octave dot org Fri Apr 15 10:48:43 2005 Subject: Re: multiline comments From: Quentin Spencer To: "John W. Eaton" CC: Geordie McBain , =?ISO-8859-1?Q?S=F8ren_Hauberg?= , help@octave.org Date: Fri, 15 Apr 2005 10:42:00 -0500 John W. Eaton wrote: > * Do these comments nest? Do you get this behavior: > > %{ 1 > %{ 2 > %} matches 2 > %} matches 1 > > or > > %{ 1 > %{ 2 > %} matches 1 > %} error, warning, or just ignored (it is a valid comment) > > OK, I did some tests to see how it all behaves. The first thing I discovered is that %{ text here is not a valid block comment; the characters "%{" must appear on a line by themselves (white space before or after is OK). It also appears that the comments do nest. I tested the following code with no errors: %{ block-commented text %{ nested block-commented text %} is this still block-commented? %} Deleting the final %} gives the error: "Unterminated %{ block. Use %} to terminate." >... >Yes, if(0) endif is the more common way of faking block comments. The >disadvantage is that the text inside the if(0) endif block must be >valid code. In a block comment, you could have anything except "%}" >at the beginning of a line. > > Yes, I've noticed that as well. ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------