Return multiple values: Difference between revisions

Content added Content deleted
(Updated for Nim 1.4: added missing parameter type. Also, replaced "auto" by the more explicit "(int, int)".)
(Added Quackery.)
Line 2,231: Line 2,231:
print "33 - 12 = %s" % difference</lang>
print "33 - 12 = %s" % difference</lang>
There is no discernible difference between "returning multiple values" and returning a single tuple of multiple values. It is just a more pedantic/accurate statement of the mechanism employed.
There is no discernible difference between "returning multiple values" and returning a single tuple of multiple values. It is just a more pedantic/accurate statement of the mechanism employed.

=={{header|Quackery}}==

Words in Quackery take zero or more arguments from the data stack and leave zero or more results on the data stack.

We can demonstrate defining and using a word <code>+*</code>, which returns the sum and product of two numbers, in the Quackery shell.

<pre>Welcome to Quackery.

Enter "leave" to leave the shell.

/O> [ 2dup + unrot * ] is +* ( a b --> a+b a*b )
... 12 23 +*
...

Stack: 35 276

/O> </pre>



=={{header|R}}==
=={{header|R}}==