Skip to content

Variables

Variables in CES are used to store values that can be accessed and modified during script execution.
Each variable must be declared with a type, a name, and an assigned value.

Declaration

To declare a variable, specify the type first, followed by the variable name.
Use : to assign the value and end the statement with ;.

Variable declaration rules

Variables in CES must be declared using : instead of =.
The = operator and compound operators such as += or -= can only be used after the variable has already been initialized.

Example:

Str name: "Thiago";
Int age: 16;
Bool active: true;

Supported types

CES currently supports the following basic types:

  • Str → text values
  • Int → integer numbers
  • Bool → true or false values
  • Hex → hexidmal values
  • Float → float values
  • List → list of values
  • Dict → dict of value

Accessing variables

To access a variable in CES, simply use its name in an expression or function call.

Example:

Str name: "Thiago";
DisplayLog(name);

Output:

console hello world

Updating variables

Variables can be updated after declaration by assigning a new value with the = operator.

Example:

Int count: 0;
count = count + 1;
DisplayLog(count);
Output:

console hello world

Explanation:

  • count starts with value 0
  • count = count + 1 updates the variable to 1