Created
February 3, 2014 10:06
-
-
Save ranma42/8781312 to your computer and use it in GitHub Desktop.
Counter-intuitive behaviour of the let-in construct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let working () = | |
let a = 6 in | |
begin // or ( | |
printfn "%A" a | |
let a = 5 in | |
printfn "%A" a | |
end // or ) | |
let b = a in | |
printfn "%A" b | |
let ugly () = | |
let a = 6 in | |
printfn "%A" a ; // <- the semicolon is needed, the indentation level does not matter (as long as it is more indented than the let) | |
let a = 5 in | |
printfn "%A" a | |
let b = a in | |
printfn "%A" b | |
let notcompiling () = | |
let a = 6 in | |
printfn "%A" a | |
let a = 5 in | |
printfn "%A" a | |
let b = a in | |
printfn "%A" b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment