Return multiple values: Difference between revisions

Content added Content deleted
(added go)
Line 33: Line 33:
}</lang>
}</lang>


You can assign to a comma-separated list of targets:
When a function returns multiple values, you must assign to a comma-separated list of targets:


<lang go>sum, difference := addsub(33, 12)
<lang go>sum, difference := addsub(33, 12)