fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 112: Iterate over map entries, ordered by keys
Idiom # 112: Iterate over map entries, ordered by keys
See
programming-idioms.org
:
Code
for k in map.keys.sort do say "$k => {map[k]}"
What are effects?
Running Example
ex112 is map := (container.ordered_map [ "un", "deux", "trois", "quatre", "cinq" ] [ "ichi", "ni", "san" , "yon" , "go" ] ) for k in map.keys.sort do say "$k => {map[k]}" # since map is already ordered_map, map.keys are already ordered for k in map.keys do say "$k => {map[k]}"
What are effects?
last changed: 2024-07-01
next: Idiom # 113: Iterate over map entries, ordered by values