algumas linguagens possuem o comando Swap
Exemplo:
a=1: b=2 PRINT "Antes: "; a, b SWAP a, b PRINT "Depois: "; a, b
Não conhecia o Swap, mas darei uma olhada!