Hi, I am trying to write a for loop which starts a...
# announcements
n
Hi, I am trying to write a for loop which starts at specific position. The ".." operator fails when "start == list.size" but works fine when "start > list.size" E.g. var input = listOf(1, 2, 3) for (i in start..input.count()) { println(input[i]) // this line throw ArrayIndexOutOfBoundException when start = count but works fine when start > count } I can do bound check and it will work fine E.g. if (start < input.count()) for (i in start..input.count()) { println(input[i]) } But Is there some way to avoid the if statement ?