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.




$ include "seed7_05.s7i";
 
const func integer: max (in array integer: values) is func
  result
    var integer: max is 0;
  local
    var integer: index is 0;
  begin
    max := values[1];
    for index range 2 to length(values) do
      if values[index] > max then
        max := values[index];
      end if;
    end for;
  end func;
 
const proc: main is func
  begin
    writeln(max([] (1, 2, 6, 4, 3)));
  end func;