Hi all, I have a procedure which needs to be used by a wide range of functions.
I have a created a very basic program which should highlight my problem :
program untitled;
function addnumbers(num1 : integer) : integer;
begin
result := num1 + 3;
end;
procedure sequence(I want the function to go here);
var
i : integer;
begin
for i := 1 to 100 do
begin
Writeln(addnumbers(i)); // the function which appears here is a parameter stated in the brackets of the function
end;
end;
begin
sequence(function name) // I want to be able to input a function here
end.
Basically I have a really complex procedure (100+ lines) which needs to be used by many functions. Instead of writing an exact copy of the procedure every time (just with different function within it) I was wondering whether the function can be called by stating it as a parameter in the procedure.
e.g.
begin
sequence(function goes here);
end.
Thanks for any help,
Greg