Skip to content

Commit ac82531

Browse files
committed
Added docs about comments
1 parent 21759eb commit ac82531

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

src/main/resources/docs/Advanced Guide

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,51 @@ introducing its own methodologies.
1010
Functions allow for very dynamic scripts to be run. There are many defined functions, including functions that provide
1111
control flow functionality. For the full list of functions, see the [[CommandHelper/API|API]]. A function is identified
1212
by a literal string, followed by parenthesis. So in <code>func()</code>, "func" is the name of the function, and "("
13-
and ")" begin and end the function argument list (in this case, there are no arguments being passed in.)
13+
and ")" begin and end the function argument list (in this case, there are no arguments being passed in.) Functions
14+
can have zero, one, or two or more arguments passed to them. In the case of two or more arguments, each argument
15+
is separated by a comma. For instance:
16+
17+
%%CODE|
18+
funcWithNoArgs();
19+
funcWithOneArg(1);
20+
funcWithTwoArgs(1, 2);
21+
funcWithThreeArgs(1, 2, 3);
22+
%%
23+
24+
===Comments===
25+
26+
Comments are a useful way to mark up your code for humans to read later. (With one exception) comments are ignored
27+
by the compiler, and you are free to put whatever information you wish in a comment. There are 4 ways to comment
28+
code.
29+
30+
The <code>#</code> and <code>//</code> symbols are identical. They are line comments. When either is encountered,
31+
the remainder of the line is ignored by the compiler. <code>//</code> is preferred over <code>#</code>, however
32+
<code>#</code> is not deprecated, nor will it ever be. The only exception to this preference is when using a
33+
hashbang for cmdline code.
34+
35+
Block comments start with </code>/*</code> and end with </code>*/</code> This causes the compiler to ignore everything
36+
within the comment block, including newlines.
37+
38+
Smart comments are like block comments, but start with <code>/**</code> (two asterisks) instead. They are currently
39+
unused, but are reserved for future use. They are used for documentation generation functionality.
40+
41+
%%CODE|
42+
code(); # line comment
43+
code(); // line comment
44+
code();
45+
/*
46+
*
47+
* block comment
48+
*
49+
*/
50+
51+
/**
52+
* Smart comment. This would generally proceed a procedure or variable declaration,
53+
* or similar structure. Note that the * at the beginning of this line is not necessary,
54+
* however it serves to help the reader more easily see that this is also part of the comment block.
55+
*/
56+
57+
%%
1458

1559
===Data Types===
1660
In a script, there are several types of data. The language is currently loosely typed however, so the string '2' is

0 commit comments

Comments
 (0)