F# Tutorial - Hello World in 5 minutes

Create your app

In your command prompt, run the following command to create your app:

In your terminal, run the following command to create your app:

Command prompt
dotnet new console -lang F# -o MyFSharpApp

Note: some terminals may require you to add quotes around F# like this: "F#".

Then, navigate to the new directory created by the previous command:

Command prompt
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
// For more information see https://aka.ms/fsharp-console-apps
printfn "Hello from F#"

Select the Continue button below to go to the next step.

Got an error?

If you receive a message similar to Template "Console Application" could not be created. Access to the path 'C:\Windows\System32\MyApp' is denied., change your current directory to one where you have permissions to create a new folder and try to run the command again.

If Windows can't find the SDK when you try to create the project and you are sure you have installed the SDK, your machine might have an issue with the PATH environment variable. See this Stack Overflow post for instructions on how to diagnose and fix this issue.

If you can't resolve the issue you're having, select the I ran into an issue button below to get help fixing the problem.

Continue