schmoniquell
2014-10-01 13:29:17
Hi. I'm trying to make a procedure that calls another procedure, just like how AddOnTerminate(const proc:string) calls whatever you give it. How do I do that? Of what data type is a procedure?
Example:
What would I put instead of the red text?
Edit: I guess another way of asking this question is: Is there a way to run a procedure whose name you have stored in a string variable? For example,
(CallProc and CallProcedure don't work)
———
Thanks so much for the answer Turpinator!!
Example:
program new;
procedure proc2;
begin
[INDENT]writeln('it works');[/INDENT]
end;
procedure proc1([COLOR="#FF0000"]nameofproc:procedure[/COLOR]);
begin
[INDENT]nameofproc; [/INDENT]
end;
begin
[INDENT]proc1('proc2');[/INDENT]
end;
What would I put instead of the red text?
Edit: I guess another way of asking this question is: Is there a way to run a procedure whose name you have stored in a string variable? For example,
program new;
var procname:string:='testprocedure';
procedure testprocedure;
begin
[INDENT]writeln('it works');[/INDENT]
end;
begin
[INDENT]CallProcedure(procname);[/INDENT]
end;
(CallProc and CallProcedure don't work)
———
Thanks so much for the answer Turpinator!!