# E4143

Not a valid constant type, only immutable primitive types are allowed.

In MoonBit, you can use `const` to declare a constant value. Only literal value
of immutable primitive types can be assigned to `const`.

- These are valid constant types: `Int`, `String`, `Byte`, `Char`, `Float`,
  `Bool`, etc.
- These are not valid constant types: `Array[Int]`, `(Int) -> Int`, `Ref[Int]`,
  etc.

## Erroneous example

```{literalinclude} /sources/error_codes/4143_error/top.mbt
:language: moonbit
```

## Suggestion

You can bind the value to a variable using `let` instead.

```{literalinclude} /sources/error_codes/4143_fixed/top.mbt
:language: moonbit
```
