Task

Pass a function     as an argument     to another function.



Related task

   First-class functions


MODULE Proc EXPORTS Main;
 
IMPORT IO;
 
TYPE Proc = PROCEDURE();
 
PROCEDURE Second() =
  BEGIN
    IO.Put("Second procedure.\n");
  END Second;
 
PROCEDURE First(proc: Proc) =
  BEGIN
    proc();
  END First;
 
BEGIN
  First(Second);
END Proc.