parameters are final and cannot be changed inside the function
🙏 2
ephemient
09/11/2021, 3:34 AM
effectively equivalent to
val
, yes
n
nkiesel
09/11/2021, 5:04 AM
if you really have to modify the value, use
var n = n
inside the function which creates a local variable with the same name, shadowing the parameter. But generally, this is not good style because it makes it appear as if you can modify the parameter (which you can not as @ephemient explained)