Task

Create a function that returns the maximum value in a provided set of values,

where the number of values may not be known until run-time.




      ListOfValues$ = "13, 0, -6, 2, 37, -10, 12"
      PRINT "Maximum value = " ; FNmax(ListOfValues$)
      END
 
      DEF FNmax(list$)
      LOCAL index%, number, max
      max = VAL(list$)
      REPEAT
        index% = INSTR(list$, ",", index%+1)
        number = VAL(MID$(list$, index%+1))
        IF number > max THEN max = number
      UNTIL index% = 0
      = max