Tutorial explains about how to write 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 and copy 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 is comments. Comment starts with // followed by comment string
  • Comments are ignored by compiler during programming execution, It is for developer readability
// Hello.fs
// FSharp Hello WOrld program
  • Next line, print the string to console using printfn function
printfn "Hello, World Welcome to my site"

printfn function prints the string to console.