76

So, I'm a javascript programmer and the new version of JavaScript (ES6) has a new keyword for declaring variables: let, next to the old one var.

I know the difference between these two, but I was asking myself: what does let stand for? var obviously is an abbreviation of "variable", but let? Is it an abbreviation as well? Where does it come from?

I googled this and to my amazement, I couldn't find an answer. I already knew Swift also has a let keyword (they use it for constants), but apparently some other programming languages use it as well.

ngstschr
  • 2,119
  • 2
  • 22
  • 38

1 Answers1

92

It comes from the English word 'let'.

verb: "let", "letting". 1. to allow or permit:

// Hey computer, can you please
let 
// this
night = 'wonderful'

Lisp has the keyword let and it's been around since 1958, though it may have come from even earlier.

Luis Sandoval
  • 75
  • 2
  • 9
azium
  • 20,056
  • 7
  • 57
  • 79
  • 13
    I've always assumed programming languages inherited it from the language of mathematical proofs, which often say e.g. "Let *x* be an integer..." – Jordan Running Oct 12 '15 at 21:11
  • 2
    @Jordan that's completely likely. You find `let` used more in functional programming languages which are built on algebraic types and category theory. – azium Oct 12 '15 at 21:12
  • 3
    I always think of it more along the lines of "let the keyword `night` equal `'wonderful'`" but that's probably just me. –  Oct 12 '15 at 21:21
  • 2
    @Jordan I found an example here: https://en.wikipedia.org/wiki/Mathematical_proof#Proof_by_mathematical_induction – ngstschr Oct 12 '15 at 21:24