SWAP

Top  Previous  Next

Action

Exchange two variables of the same type.

 

 

Syntax

SWAP var1, var2

 

 

Remarks

var1

A variable of type bit, byte, integer or word.

var2

A variable of the same type as var1.

 

After the swap, var1 will hold the value of var2 and var2 will hold the value of var1.

 

 

Example

Dim a as integer,b1 as integer

a = 1 : b1 = 2                'assign two integers

SWAP a, b1                   'swap them

PRINT a ; b1