function pointer ex1



Function Pointer example 01
Pas2JS pascal source code
type TMyProc = procedure; procedure Proc1; begin WriteLn('Proc1'); end; procedure Proc2; begin WriteLn('Proc2'); end; var p, pp: TMyProc; try p; except on E: Exception do WriteLn(E.Message) end; p := Proc1; pp := p; p; p := Proc2; p(); pp; pp := p; pp(); {<<< RESULT - CONSOLE LOG >>> ----------------------------- Function pointer is nil [line: 17, column: 5] Proc1 Proc2 Proc1 Proc2 ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}