This repository has been archived on 2023-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
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`.
|
2020-10-10 09:04:19 -05:00
|
|
|
// 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.
|
2016-02-07 11:34:53 -06:00
|
|
|
|
2020-10-10 09:04:19 -05:00
|
|
|
#[test]
|
|
|
|
fn indexing_tuple() {
|
2016-02-07 11:34:53 -06:00
|
|
|
let numbers = (1, 2, 3);
|
2020-10-14 01:20:17 -05:00
|
|
|
// Replace below ??? with the tuple indexing syntax.
|
2023-03-24 16:18:51 -05:00
|
|
|
let second: &usize = &numbers.1;
|
2020-10-10 09:04:19 -05:00
|
|
|
|
2023-03-24 16:18:51 -05:00
|
|
|
assert_eq!(2, *second, "This is not the 2nd number in the tuple!")
|
2016-02-07 11:34:53 -06:00
|
|
|
}
|