Returning Blitz Arrays from Functions

Blitz3D Forums/Blitz3D Beginners Area/Returning Blitz Arrays from Functions



Graphics 400, 300, 32, 2

; Declaration
Global a[2]

a[0]= 1
a[1]= 2
a[2]= 3

;------------------------------------

array_function(a)

; Show entries
For cnt= 0 To 2
	Text 10, (cnt+1)*15, a[cnt]
Next

WaitKey
End

;------------------------------------

; Important Funktion:
Function array_function(temp[2])
	temp[0]= 4
	temp[1]= 5
	temp[2]= 6
	
End Function




It seems that Blitz passes blitzarrays by reference:
when you're changing the values of the "temp"- array you're actually changing the values of the "a"-array.

You don't need to use any "Return" command.

(That's also new to me, never used blitzarrays that way)