Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Nested-function/Rust/nested-function.rust
Normal file
17
Task/Nested-function/Rust/nested-function.rust
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
fn make_list(sep: &str) -> String {
|
||||
let mut counter = 0;
|
||||
let mut make_item = |label| {
|
||||
counter += 1;
|
||||
format!("{}{}{}", counter, sep, label)
|
||||
};
|
||||
format!(
|
||||
"{}\n{}\n{}",
|
||||
make_item("First"),
|
||||
make_item("Second"),
|
||||
make_item("Third")
|
||||
)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{}", make_list(". "))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue