Lesson 2 of 15

Values

Values

In F#, let binds a name to a value. Bindings are immutable by default:

let x = 42
let name = "Alice"
let pi = 3.14159

Use let mutable when you need reassignment:

let mutable count = 0
count <- count + 1
printfn $"{count}"  // 1

String Interpolation

F# 5+ supports $"..." for embedding values:

let city = "Paris"
printfn $"I live in {city}."

Your Task

Create a let binding score = 100, a let mutable binding level = 1, increment level by 1, then print score and level on separate lines.

JS Transpiler loading...
Loading...
Click "Run" to execute your code.