Typically, F # does not allow a variable to be reset. Rather, it supports immutable named values ββthrough bindings. So the following is not possible:
let a = 3 a = 4
Unless you explicitly mark a as mutable :
let mutable a = 3 a <- 4
However, F # resolves the shading variable in most situations. The only restriction on this is that it cannot be done on top-level modules. But, within the function, for example, the following works fine:
let f () = let a,b = 1,2 let a,b = b,a
source share