Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Phone Book

Create a phone book HashMap with these contacts:

  • "Alice" has number "555-1234"
  • "Bob" has number "555-5678"
  • "Carol" has number "555-9999"

Look up "Bob" and print his number.

Expected output:

text
Bob: 555-5678

Hints:

  • Use .get("Bob") to look up the number
  • Use if let Some(number) = ... to unwrap the result
  • Print in the format "Bob: {number}"
rust
fn main() {
}