Kotlin Type Conversion
Type conversion is a process in which one data type variable is converted into another data type. In Kotlin, implicit conversion of smaller data type into larger data type is not supported (as it supports in java). For example Int cannot be assigned into Long or Double.
However in Kotlin, conversion is done by explicit in which smaller data type is converted into larger data type and vice-versa. This is done by using helper function.
The list of helper functions used for numeric conversion in Kotlin is given below:
Kotlin Type Conversion Example
Let see an example to convert from Int to Long.
We can also converse from larger data type to smaller data type.
Next TopicKotlin Operator