Simple question: why can’t I edit a variable array with a functional method?

For example:

struct TestStruct
        {
        var number = 0
        }

var array = [TestStruct](repeatElement(TestStruct(), count: 2))
array.forEach { $0.number += 1 }

Jan E.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to