Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linguistic meaning of 'let' variable in programming [duplicate]

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.

like image 576
ngstschr Avatar asked Oct 12 '15 21:10

ngstschr


People also ask

What does let stand for in coding?

Description. let allows you to declare variables that are limited to the scope of a block statement, or expression on which it is used, unlike the var keyword, which declares a variable globally, or locally to an entire function regardless of block scope.

What does let as variable stand for?

`let` is a signal that the variable may be reassigned, such as a counter in a loop, or a value swap in an algorithm. It also signals that the variable will be used only in the block it's defined in, which is not always the entire containing function.

Where does the let keyword come from?

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

What is the full form of let in JavaScript?

In JavaScript, let is a keyword that is used to declare a block scoped variable. Usually, the var keyword is used to declare a variable in JavaScript which is treated as a normal variable, but the variables declared using the let keyword are block scoped.


1 Answers

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.

like image 54
azium Avatar answered Oct 10 '22 13:10

azium