Array Initialization: Difference between revisions

→‎AWK: Also looks to be covered
(Creating an Associative Array could also hold some code from here)
(→‎AWK: Also looks to be covered)
Line 25:
</lang>
Note that the array bounds, when unconstrained as in these examples can be either determined by the aggregate, like the initialization of X shows. Or else they can be specified as a constraint, like for example in the initialization of Y. In this case '''others''' choice can be used to specify all unmentioned elements. But in any case, the compiler verifies that all array elements are initialized by the aggregate. Single dimensional arrays of characters can be initialized by character strings, as the variable S shows. Of course, array aggregates can participate in array expressions and these expressions can be used to initialize arrays. The variable B is initialized by an aggregate inversed by the operation '''not'''.
==[[AWK]]==
In awk, it is most usual to initialize an array either by split()
split("a b c d e",a)
or by assigning to single elements:
capital["France"]="Paris"
capital["Italy"]="Rome"
==[[AutoHotkey]]==
AutoHotkey does not have arrays yet.
Anonymous user