In this tutorial you will learn:
Data is represented in flowScript with the following base types:
Type | Decription | Example |
Boolean | a logic two state switch | true false 0 1 |
Integer | positive or negative number without fraction | 12345 -5 |
Real | positive or negative number which may have a fraction | 1.2345 1.23E-5 -1.23e-5 |
String | a text | "this is a text" |
Object | instance of an object on none |
Arrays store multiple base types consecutively and may even contain other arrays. The types can be mixed. Arrays are initialized by brackets [
]
with values separated by comma ,
.
Examples:
val = 42
mixed_array = [ 1, 2, 3, 4.5678, "hello", false, val ]
another_array = [ mixed_array, 9, 10, 11 ]
The process of converting one type to another type is called type casting. Types may be caseted from one type to another type according the following matrix:
From | to Boolean | to Integer | to Real | to String | to Object |
Boolean | 0 for true or 1 for false |
0.0 for true or 1.0 for false |
"true" "false" |
||
Integer | true for positive values, false otherwise |
value of the Integer as Real |
value as String e.g. "1234" |
||
Real | true for positive values, false otherwise |
value of the Real as Integer |
value as String e.g. "1.234" |
||
String | true if String is not empty, false otherwise |
||||
Object | true if object is a valid instance false otherwise |
the name of the object or "none" |
Type casts are not done explicitly but performed automatically if the supplied type can be casted to the target type. For example the print() command requires a String as first argument. All of the base types can be casted to a String according to the matrix above. Therefore it is possible to call print with any type as first argument.
The following predefined constant types exist in flowScript:
true
(Boolean): a logic true valuefalse
(Boolean): a logic false valuenone
(Object): Empty pointer to an object