rustlings/exercises/primitive_types/primitive_types6.rs

15 lines
496 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 the expression for the second element where ??? is so that the test passes.
2022-07-12 08:22:01 -05:00
// Execute `rustlings hint primitive_types6` or use the `hint` watch subcommand for a hint.
#[test]
fn indexing_tuple() {
let numbers = (1, 2, 3);
// Replace below ??? with the tuple indexing syntax.
2023-02-16 11:31:18 -06:00
let second = numbers.1;
assert_eq!(2, second,
"This is not the 2nd number in the tuple!")
}