From 984f1d70782ee2c7f4c3277c676c459112a165dc Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Sun, 7 Feb 2016 12:34:53 -0500 Subject: [PATCH] =?UTF-8?q?Add=20tuple=20indexing=20exercise=20from=20@rui?= =?UTF-8?q?pserra!!=20=F0=9F=91=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Connects to #29 --- primitive_types/primitive_types6.rs | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 primitive_types/primitive_types6.rs diff --git a/primitive_types/primitive_types6.rs b/primitive_types/primitive_types6.rs new file mode 100644 index 0000000..7ff9c67 --- /dev/null +++ b/primitive_types/primitive_types6.rs @@ -0,0 +1,43 @@ +// Use a tuple index to access the second element of `numbers`. +// You can put this right into the `println!` where the ??? is. +// Scroll down for hints! + +fn main() { + let numbers = (1, 2, 3); + println!("The second number is {}", ???); +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// While you could use a destructuring `let` for the tuple here, try +// indexing into it instead, as explained here: +// http://doc.rust-lang.org/stable/book/primitive-types.html#tuple-indexing +// Now you have another tool in your toolbox!