Creating an Array: Difference between revisions
Content added Content deleted
(→ActionScript: Delete.) |
(→AWK: Delete.) |
||
Line 119: | Line 119: | ||
VarSetCapacity(arrayVar, size, value) |
VarSetCapacity(arrayVar, size, value) |
||
</lang> |
</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]]== |
==[[BASIC]]== |