immutable in F#
问题 I know that variables in F# are immutable by default. But, for example in F# interactive: > let x = 4;; val x : int = 4 > let x = 5;; val x : int = 5 > x;; val it : int = 5 > So, I assign 4 to x, then 5 to x and it's changing. Is it correct? Should it give some error or warning? Or I just don't understand how it works? 回答1: When you write let x = 3 , you are binding the identifier x to the value 3 . If you do that a second time in the same scope, you are declaring a new identifier that hides