Table of Contents

LET

Assigns a value or expression to a variable; optional usage in most BASICs

Implemented by: dartmouth1, ansimin, ansifull, hptsb, decbasic, Altair, a2int, Applesoft, TI994, CBM, Atari, msatari, trs80, level2, colormc, zx81, spectrum, BBC, GWBASIC, MSX, bwbasic, bw32, ABasiC, QBasic, VBDOS, FreeBASIC, Gambas, minibasicmm, minibasicjs

With variations: ti994ext (accepting comma-separated list of variables), ataplus (mandatory for variables with names starting with or equal to reserved keywords), atxl (mandatory for variables with names starting with or equal to reserved keywords), Sinclair (mandatory for ZX80), Atom (not for array assignment)

Also written as:

Usage

With or without line numbers, LET introduces any assignment as in:

LET A = SIN(X)

In most BASICs it can simply be left out, and assignments will work anyway.

Variations

LET is almost always optional, but in some implementations it is mandatory for assignments, such as in Sinclair ZX-80 4k BASIC.

Examples

Comments

LET is one of the original keywords of the BASIC languages and must have been implemented by every single BASIC since dartmouth, but it did not take long until it became optional in almost every implementation.

Similar keywords

In other languages...

Assignment commands are not usual in other programming languages.

In Tcl/Tk, the set keyword performs pretty much like LET and is mandatory in every assignment, as Tcl/Tk syntax is positional and always requires a command as its first word of a sentence.

References