Array Initialization: Difference between revisions

Content added Content deleted
(Fortran, Perl, and Smalltalk were already noted as being covered,)
(→‎AutoHotkey: This exact code is in Creating an Array)
Line 25: Line 25:
</lang>
</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'''.
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'''.
==[[AutoHotkey]]==
AutoHotkey does not have arrays yet.
However, variables can be set to arbitrary size and pointer operations can be used, simulating arrays. Just without the syntactic sugar of '[]'.
Initialization is as follows:
<lang AutoHotkey>
size = 1000
value = 0
VarSetCapacity(arrayVar, size, value)
</lang>

==[[C++]]==
==[[C++]]==