October 2021
Intermediate to advanced
500 pages
16h 23m
English
Kotlin 1.5 introduced unsigned numeric types as a stable language feature. They are very similar to the numeric types you have seen so far, except that they cannot express negative values. Table 5.2 shows the unsigned numeric types available in Kotlin.
Table 5.2 Unsigned numeric types in Kotlin
| Type | Bits | Max Value | Min Value |
|---|---|---|---|
| UByte | 8 | 255 | 0 |
| UShort | 16 | 65,535 | 0 |
| UInt | 32 | 4,294,967,295 | 0 |
| ULong | 64 | 18,446,744,073,709,551,615 | 0 |
There are similarities and differences between these unsigned numeric types and the signed numeric types introduced earlier in this chapter. For one thing, the floating-point numeric types – Float and Double – have no unsigned counterparts. We ...
Read now
Unlock full access