swap

any, any swap(any a, any b)

any - any type (int, fixed or str)

This function returns multiple values.

Description

Returns two variables in a swapped order. This function exists to improve readability.

Examples

Without swap():

int tmp = x;
x = y;
y = tmp;

With swap():

swap(x, y);
x = r1;
y = r2;