Comparison of programming languages (associative array): Difference between revisions

Content deleted Content added
Rust: removed "use" statement to be consistent with other languages. Corrected wording.
Rust: Added looping through only keys
Line 1,680:
</syntaxhighlight>
 
YouLoop can loopiterating through all entriesthe keys of the hash thusmap:
<syntaxhighlight lang="text">
for name in phone_book.keys() {
println!("{}", name);
}
</syntaxhighlight>
 
To loop hrough all entries as tuples:
<syntaxhighlight lang="text">
for (name, number) in &phone_book {