โปรแกรมตัวอย่าง ของ ภาษาเอฟชาร์ป

โปรแกรมหา Factorial

> let rec fact = function    | 0 -> 1    | n -> n * fact(n-1);;val fact : int -> int

ผลลัพธ์

> fact 12;;val it : int = 479001600

วินโดวส์ฟอร์ม

open System.Windows.Formslet form = new Form()do form.Visible <- truedo form.TopMost <- truedo form.Text <- "Welcome to F#"let x = 3 + (4 * 5)do form.Text <- (if x = 23 then "Correct!" else "incorrect")