mirror of
https://github.com/notohh/rustlings.git
synced 2024-10-30 08:49:12 -04:00
parent
bbe1dc5937
commit
984f1d7078
1 changed files with 43 additions and 0 deletions
43
primitive_types/primitive_types6.rs
Normal file
43
primitive_types/primitive_types6.rs
Normal file
|
@ -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!
|
Loading…
Reference in a new issue