SmallBASIC
SmallBASIC copied to clipboard
min() and max(): Wrong result if parameter is a function
If you have a function wich returns an array and you want to know the minimum or maximum value of that returned array, then you can't use the function as the parameter for min() or max(). You always have to do an additional step of saving into a variable.
func TestFunction(byref A)
TestFunction = 5*A
end func
A = seq(1,3,3)
Result1 = min(TestFunction(A))
print Result1 'Prints [5,10,15]
'Workaround
temp = TestFunction(A)
Result2 = min(temp)
print Result2 'Prints 5
I have checked the source code, but I don't think I can fix this.