Le 12/06/2023 à 19:05, Steve Litt via fpc-pascal a écrit :
Busted! I used Pascal 1984-1993
So I guess you are not familiar too with the "Result" variable which appeared with Delphi 1 in 1995 if I remember correctly.

nextt:= num;

can be written to as :

Result:= num;

https://www.freepascal.org/docs-html/ref/refse94.html

I prefer Result because it reduces risks of confusion with recursive call
and you can eventually take the address of Result with @Result (where @nextt would take the address of the function nextt), pass it by reference to another function ( e.g. FillChar( Result, SizeOf(Result), 0); ) ,
it behaves like a normal variable.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to