You are handling data of different types in Kotlin and need to convert these types during runtime. You initially have a value of type Long. Your task is to first convert this Long value to Double, then convert that Double to Byte and finally print these three values. Please make sure that you are declaring the types explicitly during variable initialization and use the appropriate conversion functions for each type conversion. Reorder the lines of code given to you so that it accomplishes this task correctly.
Type conversion
Converting a Long value to Double and Byte in Kotlin
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
val myDouble: Double = myLong.toDouble()
}
fun main() {
val myByte: Byte = myDouble.toInt().toByte()
println("Long: $myLong, Double: $myDouble, Byte: $myByte")
val myLong: Long = 123
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.