Exerpad
🔥 0
0 XP
Exercise 2 · Chapter: Tuples & StructsRequired+50 XP

Destructure Tuple

Create a tuple with the values "Alice" and 12. Then destructure it into two variables called name and age, and print each one.

Expected output:

Name: Alice
Age: 12

Hints:

  • Create the tuple: let person = ("Alice", 12);
  • Destructure it: let (name, age) = person;
  • Print each variable with println!
rust
fn main() {
}
Output
Run your code to see the output here.