Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Pascal
tmp := a;
a := b;
b := tmp;

tmp needs to be a variable of type of a and b.
procedure swap(a, b: in out Integer)
is
    temp : Integer;
begin
    temp := a;
    a := b;
    b := temp;
end swap;

New implementation...
programming-idioms.org