2018-02-22 00:09:53 -06:00
|
|
|
// primitive_types6.rs
|
2016-02-07 11:34:53 -06:00
|
|
|
// 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
|
2018-11-09 13:31:14 -06:00
|
|
|
// indexing into it instead, as explained in the last example of the
|
|
|
|
// Data Types -> The Tuple Type section of the book:
|
|
|
|
// https://doc.rust-lang.org/stable/book/second-edition/ch03-02-data-types.html#the-tuple-type
|
2016-02-07 11:34:53 -06:00
|
|
|
// Now you have another tool in your toolbox!
|