> lang > arraydecl | ![]() |
| Documentation |
|
DIM Identifier AS [ NEW ] Native Datatype [ Array dimensions ... ]
Note that you can use any expression for specifying array dimensions.
| 3.0 | In Gambas 3, any datatype can be used as array element.
DIM aLabel AS NEW Label[12, 12]
DIM aResult AS NEW String[][12] ' An array of string arrays! |
The array can have several dimensions, up to a maxium of eight.
![]() | The name "DIM" for this declaration comes from the sixties, where BASIC variables did not need to be declared, except variables with dimensions. |
![]() | Gambas uses brackets [ ] instead of braces ( ) to declare and use dimensions. |
[ STATIC ] { PUBLIC | PRIVATE } Identifier [ Array dimensions ... ] AS Native DatatypeA static array is an array that is allocated directly inside the object where it is declared.
Such an array cannot be shared, and is destroyed with the object.
A static array cannot be public, and you cannot initialize it.
![]() | Do not use static arrays as local variables. It works at the moment, but may be removed in the future. |