Suggested design. No need to change memory design for the feature as code generation for current design can be utilized.
fun simple(var age:Int):Int{
age = 12
// some extra code might be here
return age
}
This is what’s supported
fun simple(age:Int):Int{
var age1 = age
// make changes to age code here
return age
}
The main reason is that this was confusing: people tend to think that this means passing a parameter by reference, which we do not support (it is costly at runtime). Another source of confusion is primary constructors: “val” or “var” in a constructor declaration means something different from the same thing if a function declarations (namely, it creates a property). Also, we all know that mutating parameters is no good style, so writing “val” or “var” infront of a parameter in a function, catch block of for-loop is no longer allowed.