Positron Compiler Documentation

Swap

Positron8 · Revision 4.0.6.5 · PDF page 359

Swap pVariable, pVariable

Swap any two variable's values with each other.

pVariable are the variables to be swapped

' 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

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.

View original PDF page 359Open page in PDFOriginal PDF page 359