It is proposed that this article be deleted because of the following concern:
If you can address this concern by improving, copyediting, sourcing, renaming, redirecting, or merging the page, please edit this page and do so. You may remove this message if you improve the article or otherwise object to deletion for any reason. Although not required, you are encouraged to explain why you object to the deletion, either in your edit summary or on the talk page. If this template is removed, do not replace it . The article may be deleted if this message remains in place for seven days, i.e., after 20:38, 5 February 2026 (UTC). Find sources: "Standard swap" – news · newspapers · books · scholar · JSTOR |
In computer science, the standard swap or three point turn[ citation needed ] is a programming paradigm that exchanges the values of two variables.
By using a third variable, whose value is otherwise of no concern, to hold the value of the first, and then assigning the second's to the first, and the third's back to the second, the values of the first two are swapped.
For example:
let temp = blet b = alet a = tempIn modern[ chronology citation needed ] CPUs this is accomplished on the processor itself, in a single machine instruction, rather than having to go through RAM. In many programming languages this can be achieved using a simple swap instruction.