RosettaCodeData/Task/Repeat/Crystal/repeat.cr
2026-04-30 12:34:36 -04:00

7 lines
127 B
Crystal

4.times{ puts "Example" } # idiomatic way
def repeat(proc,num)
num.times{ proc.call }
end
repeat(->{ puts "Example" }, 4)