[swift-users] forEach error: Parameters may not have the 'var' specifier

Zhao Xin owenzx at gmail.com
Thu Sep 1 05:38:36 CDT 2016


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>

Zhaoxin

On Thu, Sep 1, 2016 at 6:21 PM, CK TUNG via swift-users <
swift-users at 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 at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160901/7132c2b6/attachment.html>


More information about the swift-users mailing list