rustlings/exercises/primitive_types/primitive_types6.rs

48 lines
626 B
Rust
Raw Normal View History

2018-02-22 00:09:53 -06:00
// primitive_types6.rs
// 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!
// I AM NOT DONE
fn main() {
let numbers = (1, 2, 3);
println!("The second number is {}", ???);
}
2019-06-06 22:17:22 -05:00
// While you could use a destructuring `let` for the tuple here, try
// indexing into it instead, as explained in the last example of the
2018-11-09 13:31:14 -06:00
// 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
// Now you have another tool in your toolbox!