mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 21:29:18 +00:00
Closures as a separate exercises appeared to be missing, so I added some. Have placed them in the watch order after functions, which seemed reasonable.
21 lines
399 B
Rust
21 lines
399 B
Rust
// closures1.rs
|
|
// Closures are anonymous functions, but they can be assigned to a variable
|
|
// so that they can be used later on
|
|
// make me compile and pass
|
|
|
|
// Execute `rustlings hint closures1` for hints!
|
|
|
|
// I AM NOT DONE
|
|
|
|
fn main() {}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
# [test]
|
|
fn test_closure() {
|
|
let closure = ;
|
|
assert_eq!("I'm a closure",closure());
|
|
}
|
|
} |