very very starter here, so not very knewledge. Can anyone explain me why this code in Kotlin below works?
How can I initalize a val inside the loop every iteration??
val n = readln().toInt()
repeat(n) {
val next = readln().toInt()
sum += next
}