Javatpoint Logo
Javatpoint Logo

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.

  • Let binding in identifier
  • Let binding in function
  • Let binding in class

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#.


Hello FSharp

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.

Next TopicF# Type Annotation

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA