Error Lab
Every diagnostic below is the real output of ptc, not a mock-up. Pick a mistake, read how the compiler teaches the canonical form, then flip to the fix.
Immutable by default
let means "this will not change". Reassignment is an explicit opt-in via mut, so mutation is always visible at the declaration.
let limit = 10
limit = 20The compiler answers
error: cannot assign to immutable 'limit' — declare it with 'mut limit = ...' to allow reassignment (line 2, column 1)mut limit = 10
limit = 20
print("{limit}")Fixed — and it runs
20