<div dir="ltr">I'm a +1 on the return defaults with void/optional.<div><div>Within a switch I'm on the fence, it seems reasonable to break, but you may want to return.</div><div>Within a loop I'm against it, I think I think that continue makes the most sense (forEach will exhibit the same behaviour), but you may want break or return.</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 17, 2015 at 10:01 PM, Gwendal Roué <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> Le 17 déc. 2015 à 11:58, Andrey Tarantsov via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> a écrit :<br>
><br>
> 4) I would love a “guard!” variant that crashes instead of returning.<br>
<br>
</span>Isn’t it the role of assert and precondition?<br>
<br>
Yet I have to admit that assert and precondition can not replace guards like the following, which define a variable:<br>
<br>
guard let x = optionalX else {<br>
fatalError("Missing x")<br>
}<br>
// use x<br>
<br>
Gwendal Roué<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div>