Error codes › could-be-let

Error codes

could-be-let

hint Style: how the model reads (archec vet)

What it means#

A var of a body that nothing assigns again: let says so (archec vet; the quick fix and archec fix --vet write it).

Example#

A var of a ```arche body that nothing assigns after it is declared (no =, +=, no element set, not given to an out parameter or to a function that may write an array) is a value that stays as it is: let d = speed * 2.0 says so, and assigning it later is then an error (let-assigned). The quick fix writes it, and so does archec fix --vet (or --only could-be-let). A hint: a model with var everywhere stays clean.

How to fix it#

The message says what is wrong and where, and often what was meant (Did you mean …?). Change the model so that what this page describes no longer holds, then check again: archec check main.arche.

A hint: a suggestion; the model builds as it is.

A style finding: archec vet reports it, archec check does not; archec fmt --write writes the layout ones.

archec check --beginner says the most common messages in plain words, with the names that exist.

The automatic fix#

archec has no fix of its own for this code. When the message says Did you mean …?, VS Code offers that change (Quick Fix).

In the terminal#

archec explain could-be-let prints this explanation; archec explain style lists the codes of its area.