Always snap to grid

Difference between revisions of "Comments"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
(added info on javadoc, bit more explaination and eg of multico)
Line 20: Line 20:
 
<br>
 
<br>
 
[http://en.wikipedia.org/wiki/Comment_(computer_programming) Wikipedia Comment].
 
[http://en.wikipedia.org/wiki/Comment_(computer_programming) Wikipedia Comment].
 +
 +
Most of the core functionality is documented by Epic using the [[wp:Javadoc]] style of commenting files, you can however comment in any fashion you like, these are simply commenting guidelines which have become a standard that people use. It allows unified documentation of source across many languages, in this case c-type languages. As an example of an alternative one might use is [[wp:C_Sharp_(programming_language)#XML_documentation_system|C Sharp XML comments]] which is similar to javadocs but instead uses xml.
 +
 +
Acouple of notes is that multi line comments typically go as such:
 +
<uscript>/* anything in here is a comment
 +
*/</uscript>
 +
with no following *'s
 +
<uscript>/** this is useful technical information
 +
*/</uscript>
 +
is a common style used for function definition commentary.
 +
<uscript>/// single line useful information</uscript>
 +
The triple '/' is also used some in place of the double '/', in unrealscript however most of the useful single line commentary is documented using multi line comments as shown in the first example.
  
 
{{navbox unrealscript}}
 
{{navbox unrealscript}}

Revision as of 06:41, 22 April 2010

Comments are a way of inserting text into UnrealScript code to remind yourself of what the code is doing, or to give a summary of the code file. Comments will be ignored by the compiler, so they can also be used to temporarily 'disable' a line of text.

UnrealScript supports two kind of comments a single comment and a multiple line comment.
single line comments are used like this

// The commented declaration would also make the compiler ignore the declaration therefor it can be useful to disable declarations 
// for various reasons such as testing and debugging.
//var int TestVar;

and multiple line comments are used like this.

/**
 * NOTE: Never change the value of this variable to -1! the class functions always expect it to be a positive-only value!.
 */
var int TestVar;

Because the UnrealScript language commenting style is very similar to other programming languages commenting styles, the following link might be useful
Wikipedia Comment.

Most of the core functionality is documented by Epic using the wp:Javadoc style of commenting files, you can however comment in any fashion you like, these are simply commenting guidelines which have become a standard that people use. It allows unified documentation of source across many languages, in this case c-type languages. As an example of an alternative one might use is C Sharp XML comments which is similar to javadocs but instead uses xml.

Acouple of notes is that multi line comments typically go as such:

/* anything in here is a comment
*/

with no following *'s

/** this is useful technical information
*/

is a common style used for function definition commentary.

/// single line useful information

The triple '/' is also used some in place of the double '/', in unrealscript however most of the useful single line commentary is documented using multi line comments as shown in the first example.