On Feb 18, 2007, at 14:49 UTC, John McKernon wrote: > >> I now see that this is true only for base data types (strings, > >> integers, doubles etc). > > > > No, it's true for all variables of any type. But think carefully > about > > what constitutes a "change made to the passed variable". > > Now I'm a wee bit confused... > > To clarify my thinking: > > If I set X=1 and then pass x to a sub ByRef,and within that sub set > X=3, then when I return to the original method, that method will now > see x=3. > > If I set x=2 and then pass normally (byVal), and within that sub set > x=3, then when I return to the original method, that method will > still see x=1.
Right. > Reconciling this with Joe's statement about "all variables of any > time", I guess what's actually happening is that a new version of x > is returning to the calling method when I pass ByRef. Hmm, I don't understand this. What's happening if you pass ByRef is that, under the hood, you're actually passing the address of the spot in memory where X's value is stored. So in the called function, when you change the value in that memory location, of course you see this change in the caller once the method returns. HTH, - Joe -- Joe Strout -- [EMAIL PROTECTED] Verified Express, LLC "Making the Internet a Better Place" http://www.verex.com/ _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
