2

Why is ";;" required in F# interactive at the end of a command? For instance, IronPython doesn't require it?

EDIT: When do you put double semicolons in F#? covers most of the historical background

I guess my point was if you are using mostly one-liners in interactive it's cumbersome; however I see the value of ';;' when building functions interactively.

Community
  • 1
  • 1
user4
  • 734
  • 1
  • 5
  • 16

2 Answers2

2

Historically, I believe that this was inherited from OCaml - see https://stackoverflow.com/a/2669731/82959.

Community
  • 1
  • 1
kvb
  • 54,864
  • 2
  • 91
  • 133
2

How does the compiler know when you want to end your function - both of these are valid

let func() =
    System.Console.Read() |> ignore

and

let func() =
    System.Console.Read() |> ignore
    1

So we need ;; to know where the function ends

John Palmer
  • 25,356
  • 3
  • 48
  • 67