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 */ |
||
⚫ | |||
swap |
|||
"15 |
[ "15 / 3 = " write . ] bi*</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. |