Method: Glib.greatest

Defined in:
lib/glib-main.rb

.greatest(array) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/glib-main.rb', line 12

def self.greatest(array)
    if not array.kind_of?(Array) then raise TypeError end
    greatest_index = 0
    for i in 0..array.length - 1
        if array[i] > array[greatest_index]
            greatest_index = i
        end
    end
    return greatest_index
end