Return multiple values: Difference between revisions

Content deleted Content added
added php and python
m →‎{{header|Factor}}: Use bi* to prevent swap.
Line 13: Line 13:
15 3 */
15 3 */


[ "15 * 3 = " write . ]
swap
"15 * 3 = " write .
[ "15 / 3 = " write . ] bi*</lang>
"15 / 3 = " write .</lang>


Its stack effect declares that ''*/'' always returns 2 values. To return a variable number of values, a word must bundle those values into a [[sequence]] (perhaps an array or vector). For example, ''factors'' (defined in ''math.primes.factors'' and demonstrated at [[Prime decomposition#Factor]]) returns a sequence of prime factors.
Its stack effect declares that ''*/'' always returns 2 values. To return a variable number of values, a word must bundle those values into a [[sequence]] (perhaps an array or vector). For example, ''factors'' (defined in ''math.primes.factors'' and demonstrated at [[Prime decomposition#Factor]]) returns a sequence of prime factors.