As of Firmware version 2.1.0, all variables in GPC are both 16-bit and 32-bit signed integers. An integer (from the Latin integer which means whole) is a number that can be written without a fractional component. For example, 0, 20, 128, and -1000 are all integers while 4.2, 5.6, or -110.9 are not.
16-bit signed means the variables can store any value ranging from -32,768 to +32,767
32-bit signed means the variables can store any value ranging from -2,147,483,648 to +2,147,483,647
Important: GPC does not support fractions and will round any decimal to its closest whole number. Meaning 3.4 would become 3 while 3.6 would become 4.
A variable is a place where data can be stored in the memory of a Virtual Machine. Variable names can start with either an underscore ( _ ) or a letter and can be followed by any combination of letters, digits or underscores. They are case sensitive, so "cronuszen", "CronusZen" and "CRONUSZEN" would specify three different variables.
Variables defined this way in GPC are global, this means they can be accessed and modified within the init or main sections as well as a combo or function. Only variables assigned to user-created functions are local. Details of how variables operate within user functions can be found in the section.
Global variables must be declared outside of the main or init sections and therefore cannot be declared in either of those sections, as shown below:
Info: Variables are always assigned a value. If no value is assigned when they are declared, they are initialized with a value of 0 (zero). The value assigned to a variable can be altered during runtime, as shown below.
Unlike other programming languages, such as C# for example, GPC does not require a separate variable type for Boolean values. The integers in GPC have been designed to support Boolean expressions. The keywords TRUE and FALSE have been assigned the values 1 and 0 respectively as shown in the example below;
Info: You can therefore use integers in your code to create a toggle switch that enables or disables sections of code, like so;
Info: As seen in the above example, a variable will return TRUE in an if statement if it has any value other than 0 (zero). You can however use operators should you wish for your code to only be active if a variable has a certain value;