Skip to content

Instantly share code, notes, and snippets.

@ranma42
Created February 3, 2014 10:06
Show Gist options
  • Save ranma42/8781312 to your computer and use it in GitHub Desktop.
Save ranma42/8781312 to your computer and use it in GitHub Desktop.
Counter-intuitive behaviour of the let-in construct
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