/ Published in: ASP
URL: http://reusablecode.blogspot.com/2009/04/minmax.html
Select the largest or smallest value from an array of integers.
Expand |
Embed | Plain Text
<% ' Copyright (c) 2009, reusablecode.blogspot.com; some rights reserved. ' ' This work is licensed under the Creative Commons Attribution License. To view ' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or ' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California ' 94305, USA. ' Returns the numerically highest value from a given array. function max(arrNumbers) dim result result = arrNumbers(0) for each i in arrNumbers if i > result then result = i end if next max = result end function ' Returns the numerically lowest value from a given array. function min(arrNumbers) dim result result = arrNumbers(0) for each i in arrNumbers if i < result then result = i end if next min = result end function %>
You need to login to post a comment.
