From bbe1dc59372cdc79993fea68b2f1bec78263681b Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Sun, 7 Feb 2016 12:30:08 -0500 Subject: [PATCH] =?UTF-8?q?Add=20tuple=20exercise=20from=20@ruipserra!=20?= =?UTF-8?q?=F0=9F=98=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- primitive_types/primitive_types5.rs | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 primitive_types/primitive_types5.rs diff --git a/primitive_types/primitive_types5.rs b/primitive_types/primitive_types5.rs new file mode 100644 index 0000000..a34b750 --- /dev/null +++ b/primitive_types/primitive_types5.rs @@ -0,0 +1,44 @@ +// 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 Primitive Types -> Tuples section of the book: +// http://doc.rust-lang.org/stable/book/primitive-types.html#tuples +// Particularly the part about "destructuring lets". You'll need to +// make a pattern to bind `name` and `age` to the appropriate parts +// of the tuple. You can do it!!