Today we compile a F# file and run it on local environment
for a web editor user, your online environment will process the same procedure to run your f# file
- open a command window (input 'cmd' in search text input, or press Win button then input 'cmd')
- input command below
dotnet new console -lang F# -o MyFSharpApp
this command will create a program named MyFSharpApp in F#
let's check what it create for us
the only file you need to care about now is the f# source code file which end with .fs
let open our source code in nodepad
3. go back to our command window, input
cd MyFSharpApp
it will change directory (cd) to MyFSharpApp dir
4. run your code
dotnet run
output
5. check our app dir again
we got a new dir named 'bin', let's see what's inside
it contains the comile output, MyFSharpApp.exe is our application file, you can ignore other output files for right now
6. let's change our source code a little bit like below
open System
printfn "Hello from F#"
Console.ReadLine()
and run it again
dotnet run
go to the comile output dir: bin/Debug/net8.0
double click our new application file: MyFSharpApp.exe
you will see the same result like in the command window, right
actually in the command window, it also call MyFSharpApp.exe at backend, so it's the same result when you execute the exe file by double click it