What is the value of a let expression
Posted
by
Grzegorz Slawecki
on Programmers
See other posts from Programmers
or by Grzegorz Slawecki
Published on 2014-08-22T07:48:10Z
Indexed on
2014/08/22
10:27 UTC
Read the original article
Hit count: 259
functional-programming
|F#
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?
© Programmers or respective owner