# Find the maximum 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 max( 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 max $argv
Previous Sample |
List of Samples
| Next Sample
Table of Contents
Copyright © 1988-2003 by
Hamilton Laboratories.
All rights reserved.