Largest of smallest value in a collection/array of integers

studio

#1

Hi,

I have a collection of integers, and I want to pick out the index of the smallest element. E.g. for a collection (3,13,7,2), the output must be “4”.

Is there an easy way to pick out the largest or smallest element of an array or collection?


#2

Hi,

Array.FindIndex(intArray,Function(i) i = intArray.Min)

intArray being your array of inger would do.

Note however than in .Net, index are 0 based (or starting at 0 so it will be 3)
You will have to inscrement it by one.

Cheers


#3

This solved the problem. Thanks, and sorry for the late response.