F# Let Bindings
Binding is a process of associating of identifier or function to a value. Let keyword is used to bind identifier to a value. In F#, we use let keyword to declare variable, function and private class members.
We can use let binding at various level.
F# Let binding in identifier Example
Here, we are associating a value 10 to a variable (identifier) named a.
F# Let binding in function
We use let keyword to define function in F#.
F# Let Binding inside Class
We can use let binding inside class also.
Let's see an Example.
F# Scope of let binding
Scope of let binding is limited to in which it is declared, i.e. if you have declared a variable using let keyword inside a function, it is not accessible outside the function. Let binding in class is treated as private.
A identifier or a function which is declared using let keyword is limited to the local body in which it is declared.