I'm having trouble with this problem
I have an array like so
#(20, 21, 22, 23, 27, 28, 29, 30)
I need to find min and max values of consecutive elements
so my function would give me (20,23) and (27,30)
Here's what I have so far but i'm not doing it right.
for i = 1 to coneLocTimes.count do (
--coneLocTimes #(20, 21, 22, 23, 27, 28, 29, 30) --example array no need to sort as its already sorted
if conelocTimes[i] == (conelocTimes[i+1] - 1) then --test the first element in the array and see if the next element is consecutive
(
valpt1 = conelocTimes[i]
print i
-- keep looping throught the values until we find one that is none consecutive
for i = 1 to coneLocTimes.count do ( -- start of second loop
if conelocTimes[i] != conelocTimes[i+1] then
(
valpt2 = conelocTimes[i]
)
) -- end of second loop
)
)
Anubis · 2011-10-27