Comparison of programming languages (associative array): Difference between revisions

Content deleted Content added
C#: fixed syntax
Line 13:
For example:
 
<source lang=Textawk>
phonebook["Sally Smart"] = "555-9999"
phonebook["John Doe"] = "555-1212"
Line 21:
You can also loop through an associated array as follows:
 
<source lang=Textawk>
for (name in phonebook) {
print name, " ", phonebook[name]
Line 31:
Multi-dimensional associative arrays can be simulated in standard Awk using concatenation and e.g. SUBSEP:
 
<source lang=Textawk>
{ # for every input line
multi[$1 SUBSEP $2]++;