Jump to content

Associative array/Iteration: Difference between revisions

+Stata
(+Stata)
Line 2,885:
end</lang>
 
=={{header|Stata}}==
<lang stata>mata
 
// Create an associative array
a=asarray_create()
asarray(a,"one",1)
asarray(a,"two",2)
 
// Loop over entries
loc=asarray_first(a)
do {
printf("%s %f\n",asarray_key(a,loc),asarray_contents(a,loc))
loc=asarray_next(a,loc)
} while(loc!=NULL)
end</lang>
=={{header|Swift}}==
<lang swift>let myMap = [
1,336

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.