Associative array/Iteration: Difference between revisions

Add BaCon
(Add BaCon)
Line 304:
 
For more information on maps in Babel, view [https://github.com/claytonkb/clean_babel/blob/master/std.sp std.sp] (see the section titled "map utilities").
 
=={{header|BaCon}}==
<lang qbasic>DECLARE associative ASSOC STRING
 
associative("abc") = "first three"
associative("mn") = "middle two"
associative("xyz") = "last three"
 
LOOKUP associative TO keys$ SIZE amount
FOR i = 0 TO amount - 1
PRINT keys$[i], ":", associative(keys$[i])
NEXT</lang>
 
{{out}}
<pre>prompt$ ./assoc
abc:first three
mn:middle two
xyz:last three</pre>
LOOKUP creates a numerically indexed array of the keys of the associative array, with the number of elements stored in the field following the SIZE keyword.
 
=={{header|BASIC256}}==
Anonymous user