Swap
Positron8 · Revision 4.0.6.5 · PDF page 359
Syntax
Swap pVariable, pVariable
Overview
Swap any two variable's values with each other.
Parameters
pVariable are the variables to be swapped
Example
' If wDog = 10 and wCat = 20 then by using the swap command
' wDog will now equal 20 and wCat will equal 10.
Dim wDog as Word
Dim wCat as Word
wDog = 10 ' wDog equals 10
wCat = 20 ' wCat equals 20
Swap wDog, wCat ' wDog now equals 20 and wCat now equals 10
Note
If the same two Byte variables are used in the Swap command, their nibbles (low and high 4bits) will be swapped using the Swapf mnemonic.
