I wrote a simple program that takes the user's input from the console and then prints it. But when the user enters the input, it requests a second user input and only reads the second input.
Code:
fun main(args: Array<String>) {
print("Enter text: ")
val stringInput = readLine()!!
println("Readed text: $stringInput")
}
Console:
> Task :MainKt.main()
Enter text: FirstInput
SecondInput
Disconnected from the target VM, address: 'localhost:37282', transport: 'socket'
Connected to the target VM, address: '127.0.0.1:37264', transport: 'socket'
Readed text: SecondInput
I'm using the latest version of IntelliJ IDEA. I don't know why this is happening. I'm using Windows.