Skip to content

Syntax

Syntax of variable

<Type> <Variable-Name>: <Value>;

This is the basic syntax for variable declaration in CES.

Conditional syntax

Syntax if

To write a conditional statement in CES, use the if keyword followed by the condition.
The block of code must be written between { }.

if( <Condition> ){ <Code> }

Syntax else if

To add a second condition in CES, use the keyword else if after an if block. It will only execute if the previous condition is false and the new condition is true.

else if( <Condition> ) { <Code> }

Syntax else

To execute a block of code when none of the previous conditions are true, use the keyword else.

else { <Code> }

Loop syntax

Syntax while

To execute a block loop when the condition is true, use the keyword while.

while( <Condition> ) { <Code> }

Syntax for

To execute a block of code for a specific number of iterations, use the keyword for.

for(<Initializer>; <Condition>; <Updater>) { <Code> }

Functions syntax

Syntax func

To reuse a block of code several times without needing to rewrite it, use the keyword func.

func <Modifiers>  <Method-Name> ( <Parameter-List> ) : <Return-Type> { <Code> }

Classes syntax

Syntax class

To create a structure that defines a type of object, grouping data (variables) and behaviors (functions/methods) use the keyword class.

class <Class-Name> { <Methods and Proprieties> }