NAME

swap - exchange the values of two variables

SYNOPSIS

swap Var1, Var2

DESCRIPTION

Swap interchanges the values of the two variables named as arguments.  The arguments Var1 and Var2 are the names of two variables or array elements and must be either both numeric or both string.  Any type variables may be swapped (integer, single-precision, double-precision, string).  For example,
	a% = 1
	b! = 3.9
	swap a%, b!
	print a%, b!
would produce
	 4            1 

EXAMPLE

The program
	undone = 1
	while undone
		undone = 0
		for i = 1 to j - 1
			if a$(i) > a$(i+1) then_
				swap a$(i), a$(i+1) : _
				undone = 1
		next i
	wend
sorts the elements of the string array a$ into lexicographic order based on the ASCII representation.  The array a$ was defined with j elements. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber