Skip to content

Commit

Permalink
exercise done: primitive_types5
Browse files Browse the repository at this point in the history
  • Loading branch information
bahamoth committed Sep 2, 2022
1 parent 52d0ea9 commit 66e91a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions exercises/primitive_types/primitive_types4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
// Get a slice out of Array a where the ??? is so that the test passes.
// Execute `rustlings hint primitive_types4` or use the `hint` watch subcommand for a hint.

// I AM NOT DONE

#[test]
fn slice_out_of_array() {
let a = [1, 2, 3, 4, 5];

let nice_slice = ???
let nice_slice = &a[1..4];

assert_eq!([2, 3, 4], nice_slice)
}
5 changes: 2 additions & 3 deletions exercises/primitive_types/primitive_types5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Destructure the `cat` tuple so that the println will work.
// Execute `rustlings hint primitive_types5` or use the `hint` watch subcommand for a hint.

// I AM NOT DONE

fn main() {
let cat = ("Furry McFurson", 3.5);
let /* your pattern here */ = cat;
let name: &str = cat.0;
let age: f64 = cat.1;

println!("{} is {} years old.", name, age);
}

0 comments on commit 66e91a7

Please sign in to comment.