17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

LET Statement<br />

Purpose:<br />

To assign the value of an expression to a variable.<br />

Syntax:<br />

[LET] variable=expression<br />

Comments:<br />

The word LET is optional; that is, the equal sign is sufficient when assigning an expression to a<br />

variable name.<br />

The LET statement is seldom used. It is included here to ensure compatibility with previous<br />

versions of BASIC that require it.<br />

When using LET, remember that the type of the variable and the type of the expression must<br />

match. If they don't, a "Type mismatch" error occurs.<br />

Example 1:<br />

The following example lets you have downward compatibility with an older system. If this<br />

downward compatibility is not required, use the second example, as it requires less memory.<br />

110 LET D=12<br />

120 LET E=12^2<br />

130 LET F=12^4<br />

140 LET SUM=D+E+F<br />

.<br />

.<br />

.<br />

Example 2:<br />

110 D=12<br />

120 E=12^2<br />

130 F=12^4<br />

140 SUM=D+E+F<br />

.<br />

.<br />

.<br />

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

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

Saved successfully!

Ooh no, something went wrong!