Elvis throwing exceptions

Report a typo

Try to read a line. If there is no line, throw an IllegalStateException(). If there is a line, output Elvis says: $line.

Use the ?: throw construction to solve this task.

Sample Input 1:

hairstyle

Sample Output 1:

Elvis says: hairstyle
Write a program in Kotlin
fun main() {
readLine() // you need to add something
}
___

Create a free account to access the full topic