In Swift,
struct employeeStruct {
var salary=50000.0
func giveRaise(amount:Double) { salary+=amount }
}
gives a “left side of mutating operator isn’t mutable: ‘self’ is immutable” error in Swift because structure methods that update property values have to be declared as mutating
.
In Silver, the compiler doesn’t complain.