mirror of https://github.com/rust-lang/rustlings
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
538 B
Rust
45 lines
538 B
Rust
// 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!
|
|
|
|
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!
|