2 Replies Latest reply on Jan 16, 2010 3:17 PM by baianomauricioct

    returning the minimun value of an array

    baianomauricioct Level 1

      Hi all, how can I output the lower value inside an array of numbers?

      I have this but it is not doing the work, it is always returning the very first number in the array.


      function minF(a:Array):Number {      var min:Number = a[0];      for (var i:Number = 1; i>a.length; i++) {           if (a[i]>min) {                min = a[i];           } else {                trace("buahMin!");           }      }      return min; }


      Thank you all.