Comments

From Scriptwiki
Revision as of 23:57, 8 June 2007 by Albie (talk | contribs) (Added information about nested comments)

Jump to: navigation, search

Comments are used to 'comment out' code that you don't wish be used inside your scripts.

;Single line command

/*
This is a multi line comment and all code between the open comment
And the close comment will be 'commented out'
*/

Commends are used to comment out whole lines, even the multi-line comments are used to commend whole lines, which is the main difference between mIRC's commenting system and most other common languages that use /*...*/

Examples

;Comment line
/* This is a comment. */
We're still in a comment since the line above didn't start with */
So it didn't acknoledge it as the end of the comments.
*/ Since this line did, it is taken as the last line comment line.

Notes

As you can see from the above example, commends are generally line based and a commend is used to comment the whole line, including the line to end the comment block. The only exception to this rule is when you start a multi-line commend block from a concatenated line, as illistrated below:

Commands | /* Comment | Comment2
Commands2

In the above example the | is taken as a comment, nothing after the /* is taken as anything other than a comment, with the exception of a line starting a new comment. If you open a new comment inside a comment, that too must be closed before you can again issue commands.

Commands
/* Comment line one
/* Comment line two
Comment line three
*/ Comment line four
Commend live five
*/ Comment line six
Commands2

Multi-blocks and single line commends differ when it comes to parsing concatenated commands.

Commands | ;Comment | Commands2