qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
SWAP Statement
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Exchanges the values of two variables.
 
SWAP variable1, variable2
 
    ■ variable1 and variable2    Two variables of the same data type.
 
Example:
    a% = 1: b% = 2
    PRINT "Before: "; a%, b%
    SWAP a%, b%
    PRINT "After: "; a%, b%