Yes, I see, but my problem is not this. I have an array with numbers and I should create intervals from these numbers.
Exapmle:
Array: 0 1 2 3 4 5 6 8 9 12 13
Output:0 - 5 , 6 - 9, 12 - 13

My attempt is here, but there is a problem with this:

what's the value of the intervals?
I see in your example that the first set has a length of 5 but the next one only has 2 and at the last is probably for the remaining elements, is there a pattern for this?

once you know the value of the interval all you need to do is assign the value per interval to the output array

I see in your example that the first set has a length of 5 but the next one only has 2 and at the last is probably for the remaining elements, is there a pattern for this?

Because 7 , 10 and 11 is not in the array. So the length is not important. The intervals will be different long.

what does missing numbers have to do with intervals?

So the length is not important. The intervals will be different long.

I meant that the value of the interval is important to act as a counter on which value to store on the other array. If the interval value is unknown then the next value to store is guesswork

This code gives wrong result, but I do not know why.

we can't tackle the coding part of this until we get a clear picture on how the logic on the interval works

what does missing numbers have to do with intervals?

The reason of the exercise are the missing numbers. There is nothing to do with the missing numbers, but I should create intervals from the existing numbers, beacuse of the missing numbers. If there is no missing number the whole array will be only 1 interval.

so the point is numbers whose next value is missing will always be in a set regardless of the length between these numbers
e.g. input: 0, 2, 3, 4, 5, 6 output: 0, 2-6

cause this contradicts the 2nd example in your last post where 0 and 2 is not in a set
if not then shoudn't the output of your first example be like 0 - 6, 8 - 9, 12 - 13

While loop until no more numbers
set intervalStart to current number
Loop until you don't get the "next number" in sequence
Set previous number to intervalEnd
print interval
endWhile

Hello!
My question is how to code search in combobox each time typeing a letter. And the search result in DropDown have to show list items which contains letter or ...