I've seen things likeWhat is the forward used for?SCAR Code:Procedure TickleMyPickle; Forward;
I've seen things likeWhat is the forward used for?SCAR Code:Procedure TickleMyPickle; Forward;
It means that the function is declared somewhere further down the script. Normally you can only use functions that are above the current function, but sometimes you need one that's below it.
SCAR Code:program New;
procedure test;
begin
test2;
end;
procedure test2;
begin
WriteLn('hoi');
end;
begin
test;
end.
Doesn't work, because test2 is beneath test.
SCAR Code:program New;
procedure test2; forward;
procedure test;
begin
test2;
end;
procedure test2;
begin
WriteLn('hoi');
end;
begin
test;
end.
works![]()
Example...
SCAR Code:porgram ForwardExample;
function Num3: string; forward;
procedure Num1;
begin
WriteLn(Num3);
end;
function Num2: string;
begin
Result := 'Boo!...';
end;
function Num3: string;
begin
Result := Num2;
end;
Thanks! I just found out that'll be extremely useful in my script!![]()
Increase of compiling time and it can be annoying to maintain both of the declarations, but it's not that bad to use it![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)