17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GW-BASIC <strong>User's</strong> Guide<br />

SWAP Statement<br />

Purpose:<br />

To exchange the values of two variables.<br />

Syntax:<br />

SWAP variable1,variable2<br />

Comments:<br />

Any type variable may be swapped (integer, single-precision, double-precision, string), but the<br />

two variables must be of the same type or a "Type mismatch" error results.<br />

Examples:<br />

LIST<br />

10 A$="ONE ": B$="ALL ": C$="FOR "<br />

20 PRINT A$ C$ B$<br />

30 SWAP A$, B$<br />

40 PRINT A$ C$ B$<br />

RUN<br />

ONE FOR ALL<br />

ALL FOR ONE<br />

Line 30 swaps the values in the A$ and B$ strings.<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/SWAP.html28/03/2004 21.29.49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!