What is the value of a let expression
- by Grzegorz Slawecki
From what I understand, every code in f# is an expression, including let binding.
Say we got the following code:
let a = 5
printfn "%d" a
I've read that this would be seen by the compiler as
let a = 5 in
(
printfn "%d" a
)
And so the value of all this would be value of inner expression, which is value of printf. On the other hand, in f# interactive:
> let a = 5;;
val a : int = 5
Which clearly indicates that the value of let expression is the value bound to the identifier.
Q: Can anyone explain what is the value of a let expression? Can it be different in compiled code than in F# interactive?