Difference between revisions of "Comments"

From Scriptwiki
Jump to: navigation, search
(Added information about nested comments)
m (Screw the commends, typo fixing)
 
Line 7: Line 7:
 
  */
 
  */
  
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 /*...*/
+
Comments are used to comment out whole lines, even the multi-line comments are used to comment whole lines, which is the main difference between mIRC's commenting system and most other common languages that use /*...*/
  
 
== Examples ==
 
== Examples ==
Line 13: Line 13:
 
  /* This is a comment. */
 
  /* This is a comment. */
 
  We're still in a comment since the line above didn't start with */
 
  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.
+
  So it didn't acknowledge it as the end of the comments.
 
  */ Since this line did, it is taken as the last line comment line.
 
  */ Since this line did, it is taken as the last line comment line.
  
 
== Notes ==
 
== 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.
+
As you can see from the above example, comments are generally line based and a comment 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:
+
The only exception to this rule is when you start a multi-line comment block from a concatenated line, as illustrated below:
 
  Commands | /* Comment | Comment2
 
  Commands | /* Comment | Comment2
 
  Commands2
 
  Commands2
Line 28: Line 28:
 
  Comment line three
 
  Comment line three
 
  */ Comment line four
 
  */ Comment line four
  Commend live five
+
  Comment live five
 
  */ Comment line six
 
  */ Comment line six
 
  Commands2
 
  Commands2
Multi-blocks and single line commends differ when it comes to parsing concatenated commands.
+
Multi-blocks and single line comments differ when it comes to parsing concatenated commands.
 
  Commands | ;Comment | Commands2
 
  Commands | ;Comment | Commands2
  
 
[[Category:Remote]]
 
[[Category:Remote]]

Latest revision as of 22:25, 9 June 2007

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'
*/

Comments are used to comment out whole lines, even the multi-line comments are used to comment 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 acknowledge 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, comments are generally line based and a comment 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 comment block from a concatenated line, as illustrated 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
Comment live five
*/ Comment line six
Commands2

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

Commands | ;Comment | Commands2