Function Pointer var param



Function Pointer var param
Smart pascal source code
Type TProc = Procedure; procedure SayHello; begin WriteLn('Hello'); end; procedure SayBye; begin WriteLn('Bye'); end; Procedure Test(Var AProc: TProc); Begin if Assigned(AProc) then AProc; AProc := SayBye; End; var p: TProc; Test(p); Test(p); p := SayHello; Test(p); Test(p); {<<< RESULT - CONSOLE LOG >>> ----------------------------- Bye Hello Bye ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}