<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">If we were to change stuff for greater conciseness, don’t you think</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>func addInt(a: &Int, b: &Int)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>addInt(&a, &b)</div><div class=""><br class=""></div><div class="">would be a less confusing solution than messing with : and = ?</div><br class=""><div class="">
<div class="">— Radek</div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 12 Feb 2016, at 00:17, Oliver M via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 16px;" class=""><div id="yui_3_16_0_1_1455052779955_42556" class="">Regarding In-Out Parameters:</div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">My gut reaction to typing 'inout' in front of every parameter I want to call by reference is that it makes code look rather waffly.</div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">So I'm reflecting an idea on this:</div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">Use = to assign values.</div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">Use : to associate variables.</div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">A function declaration would look like this:</div><div id="yui_3_16_0_1_1455052779955_42556" dir="ltr" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" dir="ltr" class="">func addInt(add intToAdd = Int, to counterInt : Int ) {<br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" dir="ltr" class=""> counterInt += intToAdd<br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" dir="ltr" class="">}</div><div dir="ltr" id="yui_3_16_0_1_1455052779955_42903" class=""><br id="yui_3_16_0_1_1455052779955_42905" class=""></div><div dir="ltr" id="yui_3_16_0_1_1455052779955_42903" class=""><br class=""></div><div dir="ltr" id="yui_3_16_0_1_1455052779955_42903" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">Here is example code for a game of 'think of a number' where you pick a random number and do some basic maths on it.<br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">//declare the function</div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">func multiplyAdd(multiplyBy intToMultiply = Int, add intToAdd = Int, toNumber pickedInt : Int) {</div><div id="yui_3_16_0_1_1455052779955_42556" dir="ltr" class=""> pickedInt *= intToMultiply</div><div id="yui_3_16_0_1_1455052779955_42556" dir="ltr" class=""> pickedInt += intToAdd<br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" dir="ltr" class="">}<br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">//declare some variables</div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">var multiplier = 2</div><div id="yui_3_16_0_1_1455052779955_42556" class="">var adder = 3</div><div id="yui_3_16_0_1_1455052779955_42556" class="">var pickNumber = 4</div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" dir="ltr" class="">//call the function</div><div id="yui_3_16_0_1_1455052779955_42556" dir="ltr" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" dir="ltr" class="">multiplyAdd(multiplyBy = multiplier, add = adder, toNumber : pickNumber)</div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class="">It takes a little getting used to, but it does look quite clean.</div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42556" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42554" class=""><br class=""></div><div id="yui_3_16_0_1_1455052779955_42566" class=""><br class=""></div></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>