[swift-evolution] Interspersing guard let with guard boolean

Joe Groff jgroff at apple.com
Fri May 13 13:23:44 CDT 2016


> On May 13, 2016, at 11:15 AM, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Is there a technical reason that Swift cannot be expanded to allow arbitrary mixes of conditional binding and boolean assertions within a single compound guard statement?

No. You already can, we just have the somewhat strange rule that to separate `guard` conditions uses `,` before optional or pattern conditions, but `where` before boolean conditions:

	guard x == 0,
	  let y = optional where
	  z == 2 {
	}

There's no technical reason we couldn't accept either 'where' or ',' consistently.

-Joe


More information about the swift-evolution mailing list