F# runs on .NET. Save code as hello.fsx and run it with dotnet fsi hello.fsx, or type into the dotnet fsi REPL (end each entry with ;;).
F# · Lesson 1 · On the house
Values and printing
let bindings, immutability, printfn format specifiers, and running scripts with dotnet fsi. Lesson 1 is free — on the house.
Lessons · F# · Lesson 1 of 10 · On the house
Values and printing
let bindings, immutability, printfn format specifiers, and running scripts with dotnet fsi.

let x = 5 binds a name to a value. Bindings are immutable: x <- 6 is an error unless declared let mutable x = 5.
printfn is type-checked: %d int, %f float (%.2f two decimals), %s string, %b bool, %A any value in F# syntax.
String interpolation: $"{name} is {age}", or typed $"%d{age}".
Indentation is significant: a block's lines must line up; tabs are not allowed.
printfn
let name = "Ada"
let year = 1843
printfn "%s wrote notes in %d" name year
printfn "%.2f" 3.14159
printfn "%A" [1; 2; 3]
let mutable count = 0
count <- count + 1
printfn $"{name} count={count}"
Quiz
Quiz
Quiz
Quiz
Check
Match the still for: Values and printing.
Open-book: the answers are on this page. Pass every quiz and check (5) to mark the lesson done. This visit: 0/5.