Using Data Types |
Print Previous Next |
Primitive Data Types The example before used two variables with two different data types. Variables offer the possibility to store data. The kind of data depends on the data type. MADRIX Script supports the following primitive data types:
Data Type Bool The data type bool is only used internal and cannot be used to declare a variable. This data type only has to possible values, true or false. It is used for logical operations or for different statements like the if statement. For example, the following expression results in a bool data type and false as its value. 3 > 4 int i = 3 > 4 //results in 0 int i = 3 < 4 //results in 1
//usually it is used like this if(3 > 4) { do something }
Like said before, a boolean expression results only in true or false. Furthermore, the keywords true and false are used within MADRIX Script as function parameters or return values. Those parameters or functions are of the type int. In such cases true and false represent 1 and 0, respectively. They can be used in upper case (TRUE / FALSE) and lower case (true / false).
Non-Primitive Data Types - Structures Complex data types, so-called structures, consist of different elements. The elements of a structure are accessed by their names in the following way: nameOfVariable.nameOfElement. For example, col.r, if col is a variable of data type color. The following table is an overview of the structures MADRIX Script provides.
|