Skip to content

General Syntax

Kameron Brooks edited this page Nov 14, 2018 · 5 revisions

Semi-Colons!

A CCL script is a collection of statements. In general, each statement ends with a semi-colon ;. The semi-colon is mandatory.

var temp = 0; // Correct: has a semi-colon at end
var temp = 0  // Incorrect: missing semi-colon

Tabs, Whitespace and Newlines

Newlines and Indentation are recommended for readability, but are not mandatory. All white space is ignored by the lexer.

if (x == 5) {
   return x + 5;
}

is the same as:

if(x==5) {return x + 5;}

This is also technically valid, even though it is hideous:

if(x==5) {return x 
+ 5
;}

I really don't recommend that last style though...

Comments

Comments begin with //and are all line comments

// This is a comment
bool notComment = true;

Comments are the only place where a newline matters, a newline character ends a comment