Return multiple values: Difference between revisions

Content added Content deleted
imported>Arakov
imported>Thebeez
(Added uBasic/4tH version)
Line 467: Line 467:
150 LET C=A+B:LET D=A-B
150 LET C=A+B:LET D=A-B
160 END DEF</syntaxhighlight>
160 END DEF</syntaxhighlight>
==={{header|uBasic/4tH}}===
{{Trans|Forth}}
uBasic/4tH shares many features with Forth - like a stack. Parameters of functions and procedures are passed through this stack, so there is no difference between pushing the values on the stack ''or'' passing them as function parameters. Return values are passed by the stack as well, so if we push additional values ''before'' calling '''RETURN''' we can retrieve them using '''POP()'''.
<syntaxhighlight lang="qbasic">a = FUNC (_MulDiv (33, 11))
b = Pop()

Print "a * b = ";a, "a / b = ";b
End

_MulDiv
Param (2)

Push a@ / b@
Return (a@ * b@)</syntaxhighlight>
{{Out}}
<pre>a * b = 363 a / b = 3

0 OK, 0:75 </pre>


=={{header|BQN}}==
=={{header|BQN}}==