<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>If Swift ever changes to be Rust-like and have every statement actually be an expression with a non-void type (I believe this was discussed in the thread about replacing ?:), then your proposed behavior is already an implicit part of that change.<br></div>
<div>&nbsp;</div>
<div>But barring a large change like that, I'm against dropping the `return` here, as it's inconsistent with the rest of the language. The only construct today that lets you drop the return is a one-line closure, but that's already something that looks like an expression (`foo.map({ $0.x })` looks perfectly fine; `foo.map({ return $0.x })` is just unnecessary syntax). But the last statement of a function isn't an expression, it's a statement.<br></div>
<div>&nbsp;</div>
<div>-Kevin Ballard</div>
<div>&nbsp;</div>
<div>On Sat, Dec 19, 2015, at 05:30 AM, Craig Cruden via swift-evolution wrote:<br></div>
<blockquote type="cite"><div>&nbsp;</div>
<div>When writing short functional code in a function it would be nice if the return keyword were an optional keyword.&nbsp;<br></div>
<div>&nbsp;</div>
<div>Just return the last evaluated expression.<br></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>i.e.<br></div>
<div>&nbsp;</div>
<div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;"><span class="colour" style="color:rgb(187, 44, 162)">func</span> flipFunc&lt;T, U&gt;(arg1: <span class="colour" style="color:rgb(112, 61, 170)">T</span>, arg2: <span class="colour" style="color:rgb(112, 61, 170)">U</span>) -&gt; (<span class="colour" style="color:rgb(112, 61, 170)">U</span>, <span class="colour" style="color:rgb(112, 61, 170)">T</span>) {<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;">&nbsp; &nbsp; &nbsp; &nbsp; (arg2, arg1)<br></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;">&nbsp; &nbsp; }<br></div>
</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;">&nbsp;</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:11px;line-height:normal;font-family:Menlo;">&nbsp;</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;line-height:normal;">The keyword return would still be there for breaking out of a function.<br></div>
<div><img style="height:1px !important;width:1px !important;border-top-width:0px !important;border-right-width:0px !important;border-bottom-width:0px !important;border-left-width:0px !important;margin-top:0px !important;margin-bottom:0px !important;margin-right:0px !important;margin-left:0px !important;padding-top:0px !important;padding-bottom:0px !important;padding-right:0px !important;padding-left:0px !important;" border="0" height="1" width="1" alt="" src="https://www.fastmailusercontent.com/proxy/10638ee155501fadccbd20f0d27bd9893dc169bf066f71735c7fe9b0485030a1/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d3148765176786c673171614a7d2236454230345272776e465a59677d686c623059465037627d22324967774033575a7c46716153597e446579445b48503a7c4364415672416a453c4377484d443559677464695358457036516a4a75563850366657336947374777486d6268454378683f635e41437751734f49673c4a4e6642436076397f494a6054584d22364d223649513935536879517b44453178797135335172455a4a6968345e48505e684d2236427243363d22364876464e6c45567c49637f483d44585f4b4e483252305658714f6571737869623865533748756a5d67314d23344d23344/open"><br></div>
<div><u>_______________________________________________</u><br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</blockquote><div>&nbsp;</div>
</body>
</html>