Anonymous user
Creating an Array: Difference between revisions
m
→{{header|AWK}}: merging from array init
No edit summary |
m (→{{header|AWK}}: merging from array init) |
||
Line 112:
=={{header|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];
Otherwise we can initialize an array by assigning to single elements:
<lang awk>capital["France"]="Paris"
capital["Italy"]="Rome"</lang>
=={{header|BASIC}}==
|