<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 4, 2017 at 10:24 AM, Ryan Joseph <span dir="ltr"><<a href="mailto:ryan@thealchemistguild.com" target="_blank">ryan@thealchemistguild.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">But how do you assign to “something" then if you don’t know the type? The param is “var” so shouldn’t I be able to assign to the param and return it back to the caller? In your example how could I return 5 to “i” inside GetSomething?<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br></div></div></blockquote><div>Treat is as a pointer (it's an implicit pointer anyway) </div><div><br></div><div><span style="font-size:12.8px">function GetSomething (var something): boolean</span><br></div><div><span style="font-size:12.8px">var</span></div><div><span style="font-size:12.8px"> pi: PInteger; </span></div><div><span style="font-size:12.8px">begin</span></div><div><span style="font-size:12.8px"> pi:=@something;</span></div><div><span style="font-size:12.8px"> </span><span style="font-size:12.8px">GetSomething</span><span style="font-size:12.8px">:=pi^>=5;</span></div><div><span style="font-size:12.8px">end;</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">or an old-school way using "absolute". </span></div><div><span style="font-size:12.8px"><br></span></div><div><div><span style="font-size:12.8px">function GetSomething (var something): boolean;</span></div><div><span style="font-size:12.8px">var</span></div><div><span style="font-size:12.8px"> i: Integer absolute something; </span></div><div><span style="font-size:12.8px">begin</span></div><div><span style="font-size:12.8px"> GetSomething:=i>=5;</span></div><div><span style="font-size:12.8px">end;</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">var</span></div><div><span style="font-size:12.8px"> i : integer;</span></div><div><span style="font-size:12.8px">begin</span></div><div><span style="font-size:12.8px"> i:=3;</span></div><div><span style="font-size:12.8px"> writeln(GetSomething(i));</span></div><div><span style="font-size:12.8px">end.</span></div></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">check out "anysort" function </span><br></div><div><span style="font-size:12.8px"><a href="http://wiki.freepascal.org/Array_sort">http://wiki.freepascal.org/Array_sort</a></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">It's using untyped parameter to perform a sort on an arbitrary type array</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">thanks,</span></div><div><span style="font-size:12.8px">Dmitry</span></div></div></div></div>