# Did the LET statement actually do anything in 8-bit Microsoft BASICs?

I know the LET statement was available in AppleSoft and other Microsoft 8-bit BASICs back in the day, but I can't think of a time where I actually used it. Frankly, I get the impression that it was supported to conform to the Dartmouth standard but the interpreter was smart enough to not require it.

Was the LET statement actually required anywhere? Were there revisions of Microsoft BASIC that actually used it? Further, if the statement was used, did the interpreter spend any time pondering it or did it skip right past it?

• Great answers below, but tl;dr: no. In Microsoft BASIC, the LET was already completely optional. They (Bill Gates) just put it in for backward compatibility with older, non-Microsoft, standards. – Mr Lister May 28 '16 at 13:35

Except for the very earliest versions of basic, LET was rarely used, but the LET keyword was not always optional. Early BASIC interpreters required it; however, for most versions that came out for the PC (including Microsoft BASIC), the use of LET was optional.

Later standards in BASIC often required that the keyword be supported, but since there was no syntactical ambiguity in leaving it out, it was included simply to ensure compatibility with previous versions of BASIC that require it.

From MSDN » Visual BASIC:

### Let Statement

Assigns the value of an expression to a variable or property.

Syntax

[Let] varname = expression

The Let statement syntax has these parts:

Let Optional. Explicit use of the Let keyword is a matter of style, but it is usually omitted.

I've read and written quite a few BASIC interpreters way back, and the lexer definition of an assignment statement usually looked something like this:

line-number [LET] variable = expression

(line numbers were later omitted)

That means the appearance of LET is optional. The only time the interpreter spent in pondering the LET statement was in tokenizing the sequence of characters. But once it was parsed, the token was simply discarded. The use of LET didn't actually add anything in the parsing or execution of code.

• Congratulations on your first answer. This is of very high quality, and answers the question well. I would welcome you to the site, but you've been around longer than I have. - From review – wizzwizz4 May 28 '16 at 6:40

I can only answer to the first question: the LET statement was actually used in 48K Sinclair BASIC, in which due to the way commands are entered, a keyword is needed before an identifier can be typed, so LET was needed in order to write a variable assignment (although there were unofficial patches to the ROM that eliminated that requirement).

In fact, and while this is not a recommended practice, the use of the LET keyword allowed you to type things like this in Sinclair BASIC:

LET let=0
LET if i were you=2
LET i wouldnt treat me the way you do=3


These examples, BTW, won't work in some MS BASIC interpreters. I have try them with MSX-1.

• I also remember that GFA BASIC on the Atari ST and Amiga required LET – scruss May 28 '16 at 0:58

When I started programming, there was only BASIC and GW BASIC followed. In those days you had to plan and reserve your memory, because there wasn't not much. LET and DIM did that trick. LET assigned memory to a variable and with DIM you had the option to define how much memory.

• According to the GW-BASIC 3.2 manual, at least that version entirely ignored "LET". I can't find any copies of the manual for older versions, but my understanding is that no version of GW-BASIC required the use of "LET". I'm also not sure what you mean by "there was only BASIC and GW BASIC", as there were lots of different versions of BASIC around long before GW-BASIC was released in 1983. – Jules Jun 2 '16 at 20:45
• GW BASIC was very different from the BASIC version I knew. I couldn't program in GW BASIC, because I found it a little difficult and I didn't have the special editor. I started by hacking a menu written in BASIC with the use of Ctrl-Break and LIST. And I had MS DOS, PC DOS just came on the market. I was 8 or 9 years old in that time, do I don't recall it that precisely. I live in The Netherlands and I don't know if they released many DOS versions in Europe. – Jouke Nienhuis Jun 2 '16 at 20:56
• Welcome to Retrocomputing Stack Exchange. This is a good answer, however some of the content is disputed. If you can find any, could you cite your sources please? – wizzwizz4 Jun 2 '16 at 21:06
• Wow, to find my source, I have to dig deep in my DOS/BASIC archive and maybe in an old DOS manual – Jouke Nienhuis Jun 2 '16 at 21:18

I had an old TI Basic computer (Texas Instruments) and remember always using the LET statement. I recall that I was mostly copying BASIC programs from a textbook and since the textbook used the LET statement I did too for consistency sake.

• Was TI BASIC also one (like the Sinclair one mentioned above) where you had to use LET in order to enter a variable name on the keyboard? I know it had a mapping of single keyboard key to BASIC keyword, for many keys anyway. – echristopherson Jun 9 '16 at 3:45
• No, you could enter anything you wanted as a variable name on the keyboard but all the examples of TI Basic code I saw written used LET statements. – Jim Krueger Jun 9 '16 at 15:43
• This doesn't actually answer the question, "Was the LET statement actually required anywhere?" – Curt J. Sampson Jul 26 at 3:16