Microsoft Connect(); 2018
Watch now to get the latest updates on Azure and Visual Studio from the comfort of your favorite chair.
Watch on-demand >

F# Tutorial - Hello World in 10 minutes

  1. Install the .NET SDK

    To start building .NET apps you just need to download and install the .NET SDK (Software Development Kit).

  2. Create your app

    Open a new command prompt and run the following commands:

    dotnet new console -lang F# -o myApp
    cd myApp

    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 myApp where your app is stored, and populates it with the required files. The cd myApp command puts you into the newly created app directory.

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

    open System
    let main argv =
        printfn "Hello World from F#!"
        0 // return an integer exit code
  3. Run your app

    In your command prompt, run the following command:

    dotnet run

    Congratulations, you've built and run your first .NET app!

  4. Write some code

    Open Program.fs in any text editor, and change the message to say hello to you. Find the line that starts with printfn and replace World with your name.

        printfn "Hello <put-your-name-here> from F#!"

    In your command prompt, run the following command:

    dotnet run
  5. Get an editor

    Visual Studio is a fully-featured integrated development environment (IDE) for developing .NET apps on Windows.

    Download .NET and Visual Studio

  6. Keep learning

    Now that you've got the basics, let's dig deeper into the language, with a tour of F#.

    Up next: Tour of F#