I'm picking up kotlin for a new job and I'm working through the intellij hello world app for kotlin.
In the walkthrough it has you create a console app that reads in standard input and prints a greeting:
fun main(args: Array<String>) {
println("What's your name?")
val name = readLine()
println("Hello, $name")
}
Super simple.
The problem I'm running into is that when running the app, I get the prompt too enter my name, I type it in, hit enter, and nothing happens. The app is still running, but it doesn't accept the standard input off of the first enter
button press.
If I press enter one or two more times it finally accepts the input but pulls in an empty string (makes sense if it registered each of the two to three enter
button presses as a new line each).
The interaction can't be captured in screen shots that I can post here, but I did record a quick video of what's happening: https://vimeo.com/486636891
I looked up the kotlin docs on readLine and they don't really clue me in to what could be happening.
Any idea of what's going wrong here and how to fix it? Ultimately I'm not going to be writing many console apps with kotlin so it's not critical, but the idea of not being able to get through the very first hello-world app in a language/tool nags at me.
UPDATE
Hmm, it must be something with the running of the source code before building the jar.
If I continue through the tutorial to the point where I build the jar and run it the file runs fine:
Still pretty frustrating that it doesn't work without building.