RosettaCodeData/Task/Repeat/Gleam/repeat.gleam
2026-04-30 12:34:36 -04:00

15 lines
239 B
Gleam

import gleam/io
pub fn main() {
repeat(3, fn() { io.println("hello") })
}
pub fn repeat(times: Int, func: fn() -> Nil) -> Nil {
case times {
_ if times < 1 -> Nil
_ -> {
func()
repeat(times - 1, func)
}
}
}