title: Max and Min Value ... Need method to return two variable values
body: <p>I am new to coding and need help understanding what is wrong with my logic and or syntax in the following method...  The program is supposed to return the max and min values of an array.  My goal was to have two variables (max and min) outside of the method, so that as the method ran through the array the values would get replaced accordingly.  thank you for your help...</p>
  
  <pre><code>    list=[4,6,10,7,1,2]
  
  max=list[0]
  min=list[0]
  
  def maxmin(list)
  
    f=list.shift
    if list.empty?then
        return max = f 
        return min = f
    end
  
    t=maxmin(list)
    if(f&gt;t) then
      return max = f 
      return min = t
    else
      return max = t 
      return min = f
    end
  
  end
  
  printf("max=#{max}, min=#{min}, method return=%d\n", maxmin(list)) 
  </code></pre>