I have return one function:
func abc() -> [Int] {
return [1,2,3,4]
}
I'm calling this function and trying to modify the return value
abc().sort()
It gives this error:
"Cannot use mutating member on immutable value: 'abc' returns immutable value".
I know in order to change the value inside the function we need to use inout parameter but how to change the value which is returned from the function in swift?
shuffle(), you can use a variant that returns a shuffled copyshuffled(), similar tosort()vssorted())