Complete these tasks to reinforce what you learned in this module.
Create an array [1, 2, 3, 4, 5], take a slice of the middle three elements (indices 1..4), and print it.
..) and inclusive (..=) ranges. The middle three elements start at index 1 and end before index 4.// Task 1: Slice of array. See tasks/TASKS.md.
fn main() {
todo!("Slice middle three elements and print");
}
Write a function first_word(s: &str) -> &str that returns the substring up to (but not including) the first space. If there is no space, return the whole string. In main, call it with "hello world" and print the result.
Option. Use that to decide between a slice up to that index or the whole string.// Task 2: first_word. See tasks/TASKS.md.
fn main() {
todo!("Implement first_word and call with \"hello world\"");
}