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.




class Repeat {
  function : Main(args : String[]) ~ Nil {
    Repeat(Example() ~ Nil, 3);
  }
 
  function : Repeat(e : () ~ Nil, i : Int) ~ Nil {
    while(i-- > 0) {
      e();
    };
  }
 
  function : Example() ~ Nil {
    "Example"->PrintLine();
  }
}