Task

Write a procedure which accepts as arguments another procedure and a positive integer.

The latter procedure is executed a number of times equal to the accepted integer.




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