The tutorial explains how to write the F# hello world first sample program, How to compile and run the F3 code
F Sharp Hello World example
Following are steps to write a Hello World First Program in F#
- Open Notepad copy the following lines of code and save the file as
Hello.fs
// Hello.fs
// FSharp Hello World program
printfn "Hello, World Welcome to my site"
- F# code is written with a file of extension
.fs
- Following are comments. Comment starts with
//
followed by the comment string - Comments are ignored by the compiler during programming execution, It is for developer readability
// Hello.fs
// FSharp Hello World program
- Next line, print the string to the console using the
printfn
function
printfn "Hello, World Welcome to my site"
The printfn
function prints the string to the console.