• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Swift: 'If' statement needing parentheses on closure return value property access?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swift: 'If' statement needing parentheses on closure return value property access?


  • Subject: Re: Swift: 'If' statement needing parentheses on closure return value property access?
  • From: email@hidden
  • Date: Wed, 19 Aug 2015 15:24:42 +0900

Maybe file a bug to see if it's expected.
But at first glance it seems clear to be ambiguous scope. it can't figure out that the first {} is part of the condition rather than the thing triggered by the condition.

A do while knows more easily because the {} after do is what is conditionally executed.

Honestly it starts to look Perly with that much crammed in either way.

Sent from my iPhone

> On Aug 19, 2015, at 3:04 PM, Antonio Nunes <email@hidden> wrote:
>
> In Swift 2.0 I can write this:
>
>        repeat {
>           …
>        } while reminder.exclusions.filter { $0.spansTime(t) }.count > 0
>
> but I can’t write this:
>
>                if reminder.exclusions.filter { $0.spansTime(t) }.count > 0 {
>                    …
>                }
>
> which gives an error about consecutive statements on a line needing a “;”
>
> If have to write this:
>
>                if (reminder.exclusions.filter { $0.spansTime(t) }.count > 0) {
>                    …
>                }
>
>
> Any ideas why?
>
> -António
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Swift: 'If' statement needing parentheses on closure return value property access? (From: Antonio Nunes <email@hidden>)

  • Prev by Date: Swift: 'If' statement needing parentheses on closure return value property access?
  • Next by Date: Re: Swift: 'If' statement needing parentheses on closure return value property access?
  • Previous by thread: Swift: 'If' statement needing parentheses on closure return value property access?
  • Next by thread: Re: Swift: 'If' statement needing parentheses on closure return value property access?
  • Index(es):
    • Date
    • Thread