rustlings/exercises/primitive_types/primitive_types5.rs

46 lines
630 B
Rust
Raw Normal View History

2018-11-09 13:31:14 -06:00
// primitive_types5.rs
// Destructure the `cat` tuple so that the println will work.
// Scroll down for hints!
fn main() {
let cat = ("Furry McFurson", 3.5);
let /* your pattern here */ = cat;
println!("{} is {} years old.", name, age);
}
// Take a look at the Data Types -> The Tuple Type section of the book:
2019-06-06 22:17:22 -05:00
// https://doc.rust-lang.org/book/ch03-02-data-types.html#the-tuple-type
// Particularly the part about destructuring (second to last example in the section).
2018-11-09 13:31:14 -06:00
// You'll need to make a pattern to bind `name` and `age` to the appropriate parts
// of the tuple. You can do it!!