Before introduce much more the syntax,
let’s learn something about the Blackey Script’s programming language features.
Blackey’s data type is much similar to Python, however the expressions are much similar to C language.
Blackey Script is a dynamically, strongly typed programming language.
The way we assign data type is very similar to Python, such as the expression below:
// Assign x as a constant value.
x = 1;
// Assign x as a string.
x = “Hello”;
The code above will print the result as:
The dynamic type means you need to analysis data type while run-time, the opposite is static type.
For example, like C / C ++, you need to specify the data type when declaring a variable.
Strong type means it doesn’t allow the variable with incorrect data type to operate.
For example, you cannot add a constant value with a string, like below:
x = 1 + “hello”;
Basic Data Type
The basic data types of Blackey Script are only floating point and string.
The other two derived types are Position and Region.
The following types are currently supported:
|Number||x = 1;||Assign x as a constant value 1|
|String||x = “Hello”;||Assign x as a string ”Hello”|
|Position||x = pos(0.1, 0.3);||Assign x as a relative postition, the prototype is:
position(x-axis value, y-axis value)
The top-left corner of screen is start from point (0, 0)
The first (0.1) means the 10% count from the screen’s left side.
The second (0.3) means the 30% count from the screens’s top side.
The data type and expression which NOT supported.
Blackey Script only support the data types we mentions above,
so the data type and syntax below are NOT supported:
Pointer, Array, Struct, Class … etc