[swift-evolution] Proposal: Add implicit/default else-behaviour for the guard statement

Stephen Celis stephen.celis at gmail.com
Thu Dec 17 07:06:30 CST 2015


> On Dec 17, 2015, at 6:01 AM, Gwendal Roué via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Yet I have to admit that assert and precondition can not replace guards like the following, which define a variable:
> 
> 	guard let x = optionalX else {
> 	    fatalError("Missing x")
> 	}
> 	// use x

Isn't this essentially

    let x = optionalX!

:)

Stephen


More information about the swift-evolution mailing list