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

Gwendal Roué gwendal.roue at gmail.com
Thu Dec 17 07:15:46 CST 2015


> Le 17 déc. 2015 à 14:06, Stephen Celis <stephen.celis at gmail.com> a écrit :
> 
>> 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

Yes it is :-) Happy to see you there :-)

Gwendal



More information about the swift-evolution mailing list