On Wed, Jan 4, 2017 at 9:29 AM, Ryan Joseph <r...@thealchemistguild.com>
wrote:

> I’ve seen functions that use the untyped params like:
>
> function GetSomething (var something): boolean;
>
> This seems like something useful I would like to use but how can you
> assign to the parameter? I tried but I got an error message which is
> confusing because it’s a “var” after all.
>

A parameter you pass, would be passed by a reference (an address in memory)

Thus
  GetSomething(5)
will not work.


var
  i: integer;
begin
  i:=5;
  GetSometing(i)

Be careful using this open parameter, since you don't have any type
information about "something". You either should not assume the type or
pass the additional information

thanks,
Dmitry
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to