jbnizet
for (i in 0 until value) { result[index] = number index++ if (index >= array.size) { break } }