Values & References3 / 15
Up next

Parameters are local

// local holds a copy; the caller's x is untouched
fun tryChange(n: Int): Int {
    var local = n
    local += 100
    return local
}

fun main() {
    val x = 5
    val y = tryChange(x)
    println("$x $y")
}
What you're solving

a primitive argument is copied