Typecasting
Sometimes you need to convert between data types.
In the above, a * b
returns a uint
, but we were trying to store it as a uint8
, which could cause potential problems. By casting it as a uint8
, it works and the compiler won't throw an error.
Last updated