[fpc-pascal] inline function vs recursive function
Everton Vieira
tonvieira at gmail.com
Mon Feb 6 20:13:02 CET 2012
You can make a function inside the function.
Like this:
function Test: Integer;
var
i: Integer
procedure IncI(aIncI: Integer);
begin
i := i +aIncI;
end;
begin
i := 1;
while i <= 100 do
IncI(i);
Result := i;
end;
This make an geometric progression in i.
Em 06/02/2012, às 16:51, ik escreveu:
> Hello,
>
> Let's say I have a function that some of it's code (or all) can be used in more then one location inside the function itself.
> I can make a nested function with the code and set it to inline, make it normal, or make a recursion with it.
>
> What's the best practice in your opinion to take, and why ?
>
> Thanks,
> Ido
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list