On 10/15/2014 09:48 AM, Laeeth Isharc wrote: > struct RetStruct > { > double[] a; > double[] b; > } > > RetStruct myfunction(double x)
That's my preference. Tuples would work as well but they have two minor issues for me:
- Unlike a struct, the members are anonymous. (Yes, tuples members can have names as well but not when returning or creating conveniently by 'return tuple(a, b)'.)
- Unlike Python, there is no automatic tuple expansion so one has to refer to the members as result[0] and result[1], which is less readable than struct members. (Yes, there is some support for tuple expansion e.g. in foreach but it has some issues with the automatic foreach loop counter.)
Summary: I return by struct. :) Ali