You have a generic function getBigger(), which takes two arguments of the same type (a string, number, etc.) and should return the larger one. Not all types can be compared, though, and with some of them, you will get compilation problems. You need to complete the function according to the description above. Add a type bound so that your function can take only those types that implement interface Comparable<T>.
Type Bounds
Get bigger!
Report a typo
Write a program in Kotlin
// finish it!
fun <T> getBigger(a: T, b: T): T {
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
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.