Let's say I have an array like this:
val grid = Array(10) { IntArray(10) { 1 } }
And now I want to set some of them to 2 instead. I could do this:
for (i in 0..5) {
for (j in 0..5) {
grid[i][j] = 2
}
}
But what I'd like to do is this:
grid[0..5][0..5] = 2
Is there some faster way to do it like this?