Hi, Apologies in advance if this is the wrong plac...
# stdlib
c
Hi, Apologies in advance if this is the wrong place to ask this. I’m not sure if i’ve misunderstood how readln() should work, but given this code
Copy code
fun main() {
    val first = readln()
    val second = readln()
    println("[$first] [$second]")
}
and this input
Copy code
1
2
I’m getting this output
Copy code
[1] []
I would expect
Copy code
[1] [2]
Or?
n
yes,
[1] [2]
is what you should get (and what I get when running your code). Double-check your input for hidden chars (
od -c
).
c
If I run it in IntelliJ, I get the above, but when I run it directly using
java …
it works
i
If you run it in IDEA 2022.1, you're probably experiencing this bug: https://youtrack.jetbrains.com/issue/IDEA-293951
c
Yes, that’s exactly it. I’m running 2022.1.1 🙏