forEach error: Parameters may not have the 'var' specifier

This error is for Swift 3 Xcode 8 beta 6

array.forEach {( var a : AnyObject) -> () in // error here : Parameters may not have the 'var' specifier
// modify object here
}

for var a in array { // OK
// modify object here
}

You issue is more like

func foo(var bar:Int) { // error: Parameters may not have the 'var'
specifier

}

So yes, `var` is not allow any more.

Removing var from Function Parameters (SE-0003)
<https://github.com/apple/swift-evolution/blob/master/proposals/0003-remove-var-parameters.md#removing-var-from-function-parameters&gt;

Zhaoxin

ยทยทยท

On Thu, Sep 1, 2016 at 6:21 PM, CK TUNG via swift-users < swift-users@swift.org> wrote:

This error is for Swift 3 Xcode 8 beta 6

array.forEach {( var a : AnyObject) -> () in // error here : Parameters
may not have the 'var' specifier

   // modify object here

}

for var a in array { // OK

    // modify object here

}

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