Generic swap: Difference between revisions
Generic swap in True BASIC
(Generic swap in True BASIC) |
|||
Line 3,128:
As with other stack-based languages (e.g. [[Factor]] and [[Joy]]), the solution to this task is a trivial matter of swapping the top two operands on the stack:
<lang trith>swap</lang>
=={{header|True BASIC}}==
<lang qbasic>SUB swap(a, b)
LET temp = a
LET a = b
LET b = temp
END SUB
LET a = 1
LET b = 2
PRINT a, b
CALL swap(a, b)
PRINT a, b
END</lang>
=={{header|TXR}}==
|