File tree Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 2
2
3
3
Rust's macro system is very powerful, but also kind of difficult to wrap your
4
4
head around. We're not going to teach you how to write your own fully-featured
5
- modules, instead we'll show you how to use and create them.
5
+ macros. Instead, we'll show you how to use and create them.
6
6
7
7
#### Book Sections
8
8
Original file line number Diff line number Diff line change 1
1
// iterators2.rs
2
- // In this module, you'll learn some of unique advantages that iterators can offer
3
- // Step 1. Complete the `capitalize_first` function to pass the first two cases
4
- // Step 2. Apply the `capitalize_first` function to a vector of strings, ensuring that it returns a vector of strings as well
5
- // Step 3. Apply the `capitalize_first` function again to a list, but try and ensure it returns a single string
2
+ // In this module, you'll learn some of unique advantages that iterators can offer.
3
+ // Step 1. Complete the `capitalize_first` function to pass the first two cases.
4
+ // Step 2. Apply the `capitalize_first` function to a vector of strings.
5
+ // Ensure that it returns a vector of strings as well.
6
+ // Step 3. Apply the `capitalize_first` function again to a list.
7
+ // Try to ensure it returns a single string.
6
8
// As always, there are hints if you execute `rustlings hint iterators2`!
7
9
8
10
// I AM NOT DONE
Original file line number Diff line number Diff line change 3
3
// I AM NOT DONE
4
4
5
5
pub fn factorial ( num : u64 ) -> u64 {
6
- // Complete this function to return factorial of num
6
+ // Complete this function to return the factorial of num
7
7
// Do not use:
8
8
// - return
9
- // For extra fun don't use:
9
+ // Try not to use:
10
10
// - imperative style loops (for, while)
11
11
// - additional variables
12
- // For the most fun don't use:
12
+ // For an extra challenge, don't use:
13
13
// - recursion
14
14
// Execute `rustlings hint iterators4` for hints.
15
15
}
Original file line number Diff line number Diff line change @@ -640,10 +640,10 @@ name = "iterators4"
640
640
path = " exercises/standard_library_types/iterators4.rs"
641
641
mode = " test"
642
642
hint = """
643
- In an imperative language you might write a for loop to iterate through
644
- multiply the values into a mutable variable. Or you might write code more
645
- functionally with recursion and a match clause. But you can also use ranges
646
- and iterators to solve this in rust ."""
643
+ In an imperative language, you might write a for loop that updates
644
+ a mutable variable. Or, you might write code utilizing recursion
645
+ and a match clause. In Rust you can take another functional
646
+ approach, computing the factorial elegantly with ranges and iterators ."""
647
647
648
648
# TRAITS
649
649
You can’t perform that action at this time.
0 commit comments