Min.csh



#  Find the minimum numeric value out of a list.  If none of the elements
#  are numeric, return 0.

#  Copyright (c) 1996 by Hamilton Laboratories.  All rights reserved.

proc min( values )
   local i, j
   @ j = 0
   if ($#values) then
      for i = 0 to $#values - 1 do
         if (isnumber(values[i])) then
            @ j = values[i]
            break
         end
      end
      for i = i + 1 to $#values - 1 do
         if (isnumber(values[i]) && values[i] < j) @ j = values[i]
      end
   end
   return j
end

min $argv



Hamilton C shell | Free Updates | Free Demo Software | Win32 Training
Y2K | Customer Testimonials | On-line Hamilton C shell User Guide
Home | Email | Support | Company Profile | Distributors | Links



Copyright © 1997-2001 by Hamilton Laboratories. All rights reserved.
You are visitor number 451. This page was last modified August 14, 2001.