Variables
A variable never changes unless you write var mut, and every variable
states its type (Values and types).
var needed: Stock = stock_needed(per_pack, packs)var mut total: Stock = neededtotal = Stock(total + holdback)
varnames a value that never changes.var mutnames one you can point at a new value of the same type, withname = value.- Only a
var mutlocal can be assigned. Parameters, fields and declarations can't, because values never change (Values never change). - A variable is visible from where it is declared to the end of its block.
- A name already in scope, a parameter included, can't be declared again.
- A variable nothing reads is an error.
Markdown for agents: /docs/variables.md.Built from Jadpo main at a707efb.