E5006 Runtime Errors

immutable-variable

cannot modify const variable

When this occurs

Reassigning const

Example error message

error[E5006]: cannot assign to immutable variable 'x' (declared as const)

How to fix

Use `var` instead of `const` if you need to modify the variable, or remove the assignment.

Related errors