int a=4;
int b=5;
a=a+b; // 4 + 5 = 9
b=a-b; // 9 - 5 = 4
a=a-b; // 9 - 4 = 5
//variables to swap
int i = 1;
int k = 2;
//one-liner to swap variables
(i, k) = (k, i);
static void Swap<T> (ref T a, ref T b)
{
T temp = a;
a = b;
b = temp;
}
# swap variables
x = 5
y = 10
x, y = y, x
# In other languages you need a temp variable.
# temp = a;
# a = b;
# b = temp;