Check if array data increment by one?

BlitzPlus Forums/BlitzPlus Programming/Check if array data increment by one?

Pineapple(Posted 2006) [#1]
Seems simple, but god, I've either got a mental block, or I'm just getting thick in my old age (Probably the latter), but how the hell do you check whether the integer data in an array increments by one e.g.

anArray = {4,3,7,3,4,5,6,2,7,9,10}

Though, in the example, there are two sections that increment by one, the one I need is the longest which is in bold!

I've been on ages trying to figure this out, but somethings not clicking, any ideas?

Thanks in advance

Dabz


CS_TBL(Posted 2006) [#2]
convert the array to deltas and check for +1 values?


Andy_A(Posted 2006) [#3]
Or just add a dimension to your existing array to keep track of deltas, that way you can compare array values for "longest" values and deltas.


Pineapple(Posted 2006) [#4]
Gotcha fellas, I've had a bit of a think today, and I think I've got a good idea, usually the case! :)

Dabz