mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-04 01:03:31 +02:00
primitive_types6 solution
This commit is contained in:
@@ -1,21 +1,17 @@
|
||||
// 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.
|
||||
|
||||
fn main() {
|
||||
// You can optionally experiment here.
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn indexing_tuple() {
|
||||
let numbers = (1, 2, 3);
|
||||
// Replace below ??? with the tuple indexing syntax.
|
||||
let second = ???;
|
||||
|
||||
assert_eq!(2, second,
|
||||
"This is not the 2nd number in the tuple!")
|
||||
// TODO: Use a tuple index to access the second element of `numbers`
|
||||
// and assign it to a variable called `second`.
|
||||
// let second = ???;
|
||||
|
||||
assert_eq!(second, 2, "This is not the 2nd number in the tuple!");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user