Using Visual Studio & Azure?
Take a quick, 5 minute survey to help us make Visual Studio and its Azure-related experiences better.

F# Tutorial - Hello World in 10 minutes

Create your app

In your command prompt, run the following commands:

In your terminal, run the following commands:

Command prompt
dotnet new console -lang F# -o myFSharpApp
cd myFSharpApp

The dotnet command creates a new application of type console for you. The -lang parameter specifies the F# programming language and -o creates a directory named myFSharpApp where your app is stored, and populates it with the required files. The cd myFSharpApp command puts you into the newly created app directory.

The main file in the myFSharpApp folder is Program.fs. By default, it already contains the necessary code to write "Hello World from F#!" to the Console.

Program.fs
open System

[<EntryPoint>]
let main argv =
    printfn "Hello World from F#!"
    0 // return an integer exit code
Continue