number pair with condition

i want to creat a pair list of numbers

for example

1-10
11-20
21-30 = (if end position number is 27 then 21-27)

You are having logic so you can use if and procedures block to achieve this n

See: