-
Write an algorithm, in English, for how you would swap the values in two variables. For example, suppose we have two variables that have different values:
-
set
playerOneValue
to "Torch" -
set
playerTwoValue
to "Gold"
-
-
How would you swap the values so
playerOneValue
is set to "Gold" andplayerTwoValue
is set to "Torch"?- Here, "Torch" and "Gold" are just examples. Suppose the algorithm doesn't know what values the variables have before it begins.
-
Swap your algorithm with a partner and test it to determine if it works or not.