Return multiple values: Difference between revisions
Content added Content deleted
m (ANSI Standard BASIC moved to the BASIC section.) |
|||
Line 279:
end.</syntaxhighlight>
=={{header|ANSI Standard BASIC}}==▼
The most straightforward way of returning multiple values is to specify them as parameters.▼
<syntaxhighlight lang="ansi standard basic">100 DECLARE EXTERNAL SUB sumdiff▼
110 !▼
120 CALL sumdiff(5, 3, sum, diff)▼
130 PRINT "Sum is "; sum▼
140 PRINT "Difference is "; diff▼
150 END▼
160 !▼
170 EXTERNAL SUB sumdiff(a, b, c, d)▼
180 LET c = a + b▼
190 LET d = a - b▼
200 END SUB</syntaxhighlight>▼
=={{header|ARM Assembly}}==
Line 365 ⟶ 351:
=={{header|BASIC}}==
▲==={{header|ANSI Standard BASIC}}===
▲The most straightforward way of returning multiple values is to specify them as parameters.
▲<syntaxhighlight lang="ansi standard basic">100 DECLARE EXTERNAL SUB sumdiff
▲110 !
▲120 CALL sumdiff(5, 3, sum, diff)
▲130 PRINT "Sum is "; sum
▲140 PRINT "Difference is "; diff
▲150 END
▲160 !
▲170 EXTERNAL SUB sumdiff(a, b, c, d)
▲180 LET c = a + b
▲190 LET d = a - b
▲200 END SUB</syntaxhighlight>
==={{header|BaCon}}===
BaCon can return homogeneous dynamic arrays, or RECORD data holding heterogeneous types.
|