3 ms·
It allows you to assign to the "return variables" inside the function, then just return without naming all the returned values at every return. e.g. https://pl
by piinbinary 9y ago
It allows you to assign to the "return variables" inside the function, then just return without naming all the returned values at every return.
e.g. https://play.golang.org/p/gdac5QR-wW https://play.golang.org/p/gdac5QR-wW
This can also be used to return the default value for a type by never assigning anything to the return value.
- 19eightyfour 9y agoOkay, I think I get it. The format / syntax is pretty easy, simple and clean. I like it. I added a new function that takes two params and returns param, so I think I get this naming the returns now. https://play.golang.org/p/7bfiSqKY_w https://play.golang.org/p/7bfiSqKY_w I was also looking for a "spread" / ... operator, but couldn't see a way to do that.