Passing variables by reference

BlitzMax Forums/BlitzMax Beginners Area/Passing variables by reference

Josepho(Posted 2007) [#1]
How can i pass variables as reference in the bmax functions? Is this possible? Like

int function_reference(int & number, int & number2)

in c++


tonyg(Posted 2007) [#2]
You might mean 'Var'.


Grey Alien(Posted 2007) [#3]
Type var into the IDE, double click it and press F1 and you'll get the help which says

Rem
Var is a composite type containing a reference to a variable of the 
specified Type.
End Rem

' the following illustrates parsing function parameters by reference

Function ReturnMultiplevalues(a Var,b Var,c Var)
	a=10
	b=20
	c=30
	Return
End Function

Local x,y,z

ReturnMultipleValues(x,y,z)

Print "x="+x	'10
Print "y="+y	'20
Print "z="+z	'30



Josepho(Posted 2007) [#4]
Oh, thank you!


Brucey(Posted 2007) [#5]
Yeah... like "Var is a composite type containing a reference to a variable of the specified Type." explains it clearly ;-)

How's about. "To pass by reference, use Var, as this example demonstrates"

Wish we had better documentation...

In fact, it's a shame it's not as fully featured as my old Blitz Basic II manual I was just having a flick thru....