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 22
33Rust's macro system is very powerful, but also kind of difficult to wrap your
44head 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.
66
77#### Book Sections
88
Original file line number Diff line number Diff line change 11// 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.
68// As always, there are hints if you execute `rustlings hint iterators2`!
79
810// I AM NOT DONE
Original file line number Diff line number Diff line change 33// I AM NOT DONE
44
55pub fn factorial ( num : u64 ) -> u64 {
6- // Complete this function to return factorial of num
6+ // Complete this function to return the factorial of num
77 // Do not use:
88 // - return
9- // For extra fun don't use:
9+ // Try not to use:
1010 // - imperative style loops (for, while)
1111 // - additional variables
12- // For the most fun don't use:
12+ // For an extra challenge, don't use:
1313 // - recursion
1414 // Execute `rustlings hint iterators4` for hints.
1515}
Original file line number Diff line number Diff line change @@ -640,10 +640,10 @@ name = "iterators4"
640640path = " exercises/standard_library_types/iterators4.rs"
641641mode = " test"
642642hint = """
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 ."""
647647
648648# TRAITS
649649
You can’t perform that action at this time.
0 commit comments