Read a line from standard input, throwing on EOF.
The readln function reads a line from standard input and returns it as a String. Unlike readLine, it throws a RuntimeException if the end of input has been reached.
The returned string does not include the trailing newline character. This function was introduced in Kotlin 1.6 as a more concise and null-safe alternative to readLine()!!.
For a null-safe version, use readlnOrNull() instead.
print("Enter a number: ")
val input = readln()
val number = input.toInt()
println("You entered: $number")