I am confused as to what the issue is here. I have an function:
def myFunc(activity:Activity):updatedActivity = {
//var updatedActivity:Activity = activity <- This doesnt work either
var updatedActivity:Activity = activity.copy()
val params = Params (
"Attribute"
)
updatedActivity.parameters = params
updatedActivity
}
This will not work, because reassigning an attribute updatedActivity.parameters = params throws a reassignment of val error, even though updatedActivity is a var. How can I update the activity parameter I passed in and return it?
updatedActivitymay be avar, but if it's a case class then the attributeparametersis definitely aval, this is why you are getting the error.