CSS supports arrays with up to 16 dimensions. Since a var may hold any text or number, an array can take some functionality of structs: const adr[3][2] = {
{ 1, 'fred' },
{ 2, "john" },
{ 3, 'jane' }
};
Local arrays (e.g. declared within a function) are allocated at runtime and may have variable indexes. This is a unique feature of CSS you won't find in C/C++: var x = 12;
var aa[++x]; // aa holds 13 elements
var bb[x*2]; // bb holds 26 elements
Global arrays must be declared with constant indexes. This restriction is imposed since global var's and const's are allocated at compile time. |