Wednesday, July 26, 2006

ARRAY: getting the highest value

Dim arrValue
Dim m, x
'Array Data
arrValue = Array(5,10,100,20,34,79,0,55,11,33)

'Get the highest value
m=LBound(arrValue)
FOR x=LBound(arrValue)+1 TO UBound(arrValue)
IF arrValue(x)>arrValue(m) THEN m=x
NEXT
Response.write arrValue(m) & " the higest value!"

----------------------------
Result:
100 the highest value!

No comments: