BBC BASIC for Windows
Programming >> BBC BASIC language >> Another way to comment code
http://bb4w.conforums.com/index.cgi?board=language&action=display&num=1240901264

Another way to comment code
Post by Michael Hutton on Apr 28th, 2009, 06:47am

Another way to comment sections of code which people might like, rather than using REM or *| (also *| is not removed when compiled) is this:


:\
\\ you must start the commented area with :\
\\
\\ You can add multiple lines of comment
\\ like this
\\
\\ and this
\\
\\
\\
\\
\\ (you can't leave blank lines)
\\
\\ and you must end with a single backslash
\

I don't know if this commentry is removed by the compiler though.

Michael
Re: Another way to comment code
Post by Michael Hutton on Oct 13th, 2009, 02:44am

You can also comment your ASM code by inserting

Code:
;\ A comment
 


or a block of comments with:

Code:
;\ Commentry
;\ More comments
;\ And more....
 


I haven't yet checked that the 'compile' option ignores these comments but I it does 'compile' with no errors.

Michael
Re: Another way to comment code
Post by admin on Oct 14th, 2009, 1:25pm

Quote:
You can also comment your ASM code by inserting ;\ A comment

Do remember, though, that an assembler comment ends at the next colon (for some strange reason known only to Acorn) so what you suggest is potentially misleading because there could be more assembler statements on the same line (which will be rendered in green by the editor).

Richard.
Re: Another way to comment code
Post by Michael Hutton on Oct 14th, 2009, 2:56pm

Ah.

Indeed:
Code:
        ;\ a comment : inc dword [^A%]
 

compiles correctly but is misleading. So this form should be avoided.

Michael