let (binding)
Try it yourself →Gives a name to a value (immutable).
Syntax
let name = value
Description
let binds a name to a value. In Haskell, values are immutable — you cannot reassign a new value to a name later; instead, you derive a new name.
Example
main = do let x = 10 let y = x + 5 print y
Expected output
15
When to use?
Naming intermediate results.