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.




MODULE Repeat;
FROM Terminal IMPORT WriteString,WriteLn,ReadChar;
 
TYPE F = PROCEDURE;
 
PROCEDURE Repeat(fun : F; c : INTEGER);
VAR i : INTEGER;
BEGIN
    FOR i:=1 TO c DO
        fun
    END
END Repeat;
 
PROCEDURE Print;
BEGIN
    WriteString("Hello");
    WriteLn
END Print;
 
BEGIN
    Repeat(Print, 3);
 
    ReadChar
END Repeat.