return Array?
BlitzMax Forums/BlitzMax Beginners Area/return Array?
| ||
Hi, I would like to return several values with a return statement. I thought I could return an array, but this doesn't work. Should I return an object or what is possible?? |
| ||
Function MyFunct:Int[](pars:Int[]) Local temp_array:Int[]=New Int[pars.length] For Local k:Int = 0 Until pars.length temp_array[k] = pars[pars.length - k] Next Return temp_array End Function Local result:Int[]=MyFunct([1 , 2 , 3 , 4 , 5]) For Local i:Int = EachIn result Print i Next Dont' tested. Of course you can return only data of the SAME type (ie: ALL ints, ALL floats and so on...for mixed data you need a type) |
| ||
ahh, cool, I forgot to add the return type in the function head (again), mean the []. Many thanks...Function MyFunct:Int[]() . . |