Anonymous user
Return multiple values: Difference between revisions
Add SenseTalk implementation
(Added Quackery.) |
(Add SenseTalk implementation) |
||
Line 2,454:
Sum: 8
Diff: 2
</pre>
=={{header|SenseTalk}}==
You can return multiple values in SenseTalk by returning a list, which can be assigned to multiple variables.
<lang sensetalk>set [quotient,remainder] to quotientAndRemainder(13,4)
put !"The quotient of 13 ÷ 4 is: [[quotient]] with remainder: [[remainder]]"
to handle quotientAndRemainder of num, divisor
return [num div divisor, num rem divisor]
end quotientAndRemainder</lang>
{{out}}
<pre>
The quotient of 13 ÷ 4 is: 3 with remainder: 1
</pre>
|