Mutable Function Parameters

Hey everyone,

I was just thinking why can’t we optionally (and without any modifiers they are val) have mutable function parameters like:

fun (var convertView: View?) {
    if (convertView == null) convertView = View(activity)
    // do something with convertView
}
1 Like

This was discussed here: Function parameters are "val" not "var"?
The rationale for this behavior is explained here in “Parameters are Immutable” section: Kotlin M5.1 | The Kotlin Blog