Task

Show how to return more than one value from a function.




data$ ="5 6 7 22 9 3 4 8 7 6 3 -5 2 1 8 9"
 
a$ =minMax$( data$)
print " Minimum was "; word$( a$, 1, " "); " & maximum was "; word$( a$, 2, " ")
 
end
 
function minMax$( i$)
min = 1E6
max =-1E6
i =1
do
    t$    =word$( i$, i, " ")
    if t$ ="" then exit do
    v     =val( t$)
    min   =min( min, v)
    max   =max( max, v)
    i =i +1
loop until 0
minMax$ =str$( min) +" " +str$( max)
end function