Associative array/Iteration: Difference between revisions

Content added Content deleted
m (MiniScript: added comment and changed map name to avoid built-in type)
Line 272: Line 272:


<lang arturo>// create a dictionary
<lang arturo>// create a dictionary
dict #{
dict: #{
name "john"
name: "john"
surname "doe"
surname: "doe"
age 33
age: 33
}
}


Line 283: Line 283:
}
}


"----"
print "----"


// Iterate over keys
// Iterate over keys
loop $(keys dict) {
loop [keys dict] {
print "key = " + &
print "key = " + &
}
}


"----"
print "----"


// Iterate over values
// Iterate over values
loop $(values dict) {
loop [values dict] {
print "value = " + &
print "value = " + &
}</lang>
}</lang>