Primitive Types
BlueScript provides six primitive types as well as object types:
integer(30-bit integer)int32(32-bit integer)number(an alias ofinteger)float(30bit floating-point number)stringbooleannullandundefined(they are the same)any
Any kind of value can be implicitly converted into the any type, and vice versa.
- Before being converted into the
anytype, anintegervalue may be stored as a 32-bit integer. - An
int32value is always stored as a 32-bit integer. It is never converted into theanytype. - Before being converted into the
anytype, anfloatvalue may be stored as a 32-bit floating-point number. After being converted into theanytype, it is stored as a 30-bit floating-point number, where only 6 bits are allocated for an exponent instead of 8 bits. - For logical operations and the condition expressions of coditional/loop statements
such as
ifandwhile, 0, 0.0,false,null, andundefinedare considered as false while other values are true.