DescriptionDefine.<type> [<variable> [= <expression>], <variable> [= <expression>], ...]
Assign the same data type to a series of variables.
Without this keyword, variables are created with the default type of PureBasic which is the type INTEGER. As a reminder, the type INTEGER is:
4 bytes (with a 32-bit compiler) ranging from -2147483648 to + 2147483647
8 bytes (with a 64-bit compiler) ranging from -9223372036854775808 to +9223372036854775807
Define.b a, b = 10, c = b*2, d ; these 4 variables will be byte typed (.b)Define is very flexible because it also allows you to assign a type to a particular variable within a series.
Define.q a, b.w, c, d ; a, c, and d are Quad (.q) whereas b is a Word (.w) Debug SizeOf(a) ; will print 8 Debug SizeOf(b) ; will print 2, because it doesn't have the default type Debug SizeOf(c) ; will print 8 Debug SizeOf(d) ; will print 8Define can also be used with arrays, the lists and the maps.
DescriptionDefine <variable>.<type> [= <expression>] [, <variable>.<type> [= <expression>], ...]
Alternative possibility for the variable declaration using Define.
Define MyChar.c Define MyLong.l Define MyWord.w Debug SizeOf(MyChar) ; will print 2 Debug SizeOf(MyLong) ; will print 4 Debug SizeOf(MyWord) ; will print 2