RosettaCodeData/Task/Repeat/Rust/repeat-6.rust
2023-07-01 13:44:08 -04:00

11 lines
187 B
Text

fn repeat(f: impl FnMut(usize), n: usize) {
(0..n).for_each(f);
}
fn main() {
let mut mult = 1;
repeat(|x| {
print!("{};", x * mult);
mult += x;
}, 5);
}