E3020 Type Errors

negative-to-unsigned

cannot assign negative value to unsigned type

When this occurs

Assigning negative literal to unsigned int type

Example error message

error[E3020]: cannot assign negative value -5 to unsigned type 'uint'

How to fix

Unsigned types cannot hold negative values. Use a signed type or ensure the value is non-negative.

Related errors