Creating an Array: Difference between revisions

→‎AWK: Delete.
(→‎ActionScript: Delete.)
(→‎AWK: Delete.)
Line 119:
VarSetCapacity(arrayVar, size, value)
</lang>
 
==[[AWK]]==
"Numeric" arrays coincide with hashes in awk. Indices begin at 1. The <tt>split</tt> function can be used to initialize an array from a string with elements separated by a field separator (space by default)
<lang awk>BEGIN {
split("this and that",a)
for(i in a) print i":"a[i];
}</lang>
Otherwise we can initialize an array by assigning to single elements:
<lang awk>capital["France"]="Paris"
capital["Italy"]="Rome"</lang>
 
==[[BASIC]]==
Anonymous user