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
###Let Statement
AssignsAssigns 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.