Passing variables by reference?

BlitzMax Forums/BlitzMax Programming/Passing variables by reference?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I noticed in the documentation it says you can pass a variable by reference like:

Local myvar:Int=5

Function myfunction:Int(sameasmyvar Var)
   sameasmyvar:+2
   Return sameasmyvar
End Function

Print myvar

'Should print 7, right?

Ie instead of creating a new variable to pass the parameter into, it actually uses the one that was already defined outside of the function? So you can define a variable as a local outside the function and it will still be used as a Local inside the function?