Salt and Pepper Pseudo code
Pseudo code for swapping two values
In the illustration, the value of num1 is 5; the value of num2 is 12. We would like to swap num1 and num2 so that num1 is 12 and num2 is 5. We will use another variable, temp.

This is the algorithm for a classic swap. You will probably use this algorithm many times. Note that in an assignment statement, the variable that gets a new value is always on the left and the new value or expression is always on the right.
- temp=num1

- num1=num2

- num2=temp
