Return Array From Function

BlitzMax Forums/BlitzMax Beginners Area/Return Array From Function

An example in the spirit of things...

size = 10

Local MyPants [size]

MyPants = GetPants (size)

For a = 0 Until size
	Print MyPants [a]
Next

' The [] after the name denotes the function returns an array...

Function GetPants [] (num)

	Local Pants [num]
	
	For a = 0 Until Len (Pants)
		Pants [a] = a
	Next
	
	Return Pants
	
End Function