# Jamie Balfour'sPersonal blog

ZPE's implementation of by reference variables was a tricky one since the underlying Java does not give access to such a powerful tool.

Since version 1.7.0 Reindeer Lake, which was officially released yesterday, ZPE has supported by reference variables and will continue to make them more powerful. As these are new, there is currently no documentation on them. I will add some soon. In the meantime, I thought it might be a good idea to use my blog to explain these in more detail.

ZPE/YASS by reference is achieved with a ZPEVariableReference object which points to an actual ZPEVariable. Changes can be made to overwrite these in functions or to overwrite just their value. A change to the value will change the original value. Let's see it with code:

YASS
function main()

$y = 5 j(&$y)
print($y) end function function j($y)

$v =$y + 10
print($v) &$y = 10
print(&$y) end function  Notice the changes between using &$ and just $. If using the$ syntax in an assignment, it will destroy the reference. Also note, the parameter name is still just $y, even though it contains a pointer. To access the parameter$y as though it were a pointer, it is simple enough to just put an & in front of it as shown on line 14.

That's all there is to ZPE by reference variables so far. I will continue to improve them over the next few versions so keep an eye out!

zpe
byref
by
reference
variables
1.7.0
1.7.1