Skip to content

Instantly share code, notes, and snippets.

@ranma42
Created February 3, 2014 10:37
Show Gist options
  • Save ranma42/8781729 to your computer and use it in GitHub Desktop.
Save ranma42/8781729 to your computer and use it in GitHub Desktop.
Different combinations of let[-in] expression in the F# interactive
let a = 3
a + 4
;;
(* =>
val a : int = 3
val it : int = 7
*)
a + 5
;;
(* => val it : int = 8 *)
let b = 3 in
b + 4
;;
(* =>
val b : int = 3
val it : int = 7
*)
b + 5
;;
(* => val it : int = 8 *)
let c = 3 in c + 4
;;
(* => val it : int = 7 *)
c + 5
;;
(* => error FS0039: The value or constructor 'c' is not defined *)
let d = 3 in d + 4
d + 5
;;
(* =>
warning FS0020: This expression should have type 'unit', but has type 'int'. Use 'ignore' to discard the result of the expression, or 'let' to bind the result to a name.
val it : int = 8
*)
let e = 3 in
e + 4
e + 5
;;
(* =>
val e : int = 3
val it : int = 8
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment