Guest User

Untitled

a guest
Dec 11th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. fn repeat(n: i64, f: &impl Fn()) {
  2. if n > 0 {
  3. f();
  4. for _ in 0..n {
  5. repeat(n - 1, f);
  6. }
  7. }
  8. }
  9.  
  10. fn main() {
  11. repeat(3, &|| {println!("hi")});
  12. }
Add Comment
Please, Sign In to add comment