Associative array/Iteration: Difference between revisions

Content added Content deleted
No edit summary
Line 925: Line 925:


=={{header|EasyLang}}==
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
<syntaxhighlight>
# use array of array for this
associative$[][] = [ [ 1 "associative" ] [ 2 "arrays" ] ]
clothing$[][] = [ [ "type" "t-shirt" ] [ "color" "red" ] [ "size" "xl" ] ]
print "Key-value pairs:"
for i = 1 to len associative$[][]
for i to len clothing$[][]
print associative$[i][1] & " " & associative$[i][2]
print clothing$[i][1] & ": " & clothing$[i][2]
.</syntaxhighlight>
.
print "Just keys:"
for i = 1 to len associative$[][]
print associative$[i][1]
.
print "Just values:"
for i = 1 to len associative$[][]
print associative$[i][2]
.
</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Key-value pairs:
1 associative
2 arrays
Just keys:
1
2
Just values:
associative
arrays
</pre>


=={{header|EchoLisp}}==
=={{header|EchoLisp}}==