# swap

`import { swap } from "destack:memory";`

Exchange the values at `left` and `right`.

```ds title="swap"
export declare function swap<T>(left: &'a exclusive T, right: &'b exclusive T): void
```

[language/library/src/memory/swap.ds:3](https://github.com/destack-sh/destack/blob/main/language/library/src/memory/swap.ds#L3)
