swap Reference

Swap position of two numbers

swap

Description

Swaps the values of its inlets, preserving right-to-left ordering. The first outlet type is determined by its argument. The second outlet's type is always a float.

Examples

Numbers are sent out in reverse order from the order in which they were received

Arguments

initial [int or float]

Optional

Sets an initial value for the number which is to be sent out the left outlet. If there is no argument, the initial value is 0. If there is an int argument or no argument, an int is sent out the left outlet. (The number sent out the right outlet is always a float.)

Attributes

Common Box Attributes

Messages

bang

In left inlet: Swaps and sends out the numbers currently stored in fswap.

int

Arguments

input [int]
If there is a float argument, the numbers are converted to float. If there is an int argument or no argument, the number received in the right inlet is stored as an int. See the float entry for more details.

  (inlet1)

Arguments

input [int]
In right inlet: The number is stored to be sent out the left outlet when a number is received in the left inlet.

float

Arguments

input [float]
In left inlet: The number is sent out the right outlet, then the number in the right inlet is sent out the left outlet.

  (inlet1)

Arguments

input [float]
In right inlet: The number is stored to be sent out the left outlet when a number is received in the left inlet.

Output

float

The number sent out the right outlet is always a float. The number sent out the left outlet is a float only if there is a float argument.

int

When a number is received in the left inlet, the number in each inlet is sent out the opposite outlet. If there is an int argument or no argument, an int is sent out the left outlet.

See Also

Name Description
join
pack
unjoin
unpack