I'm new to Kotlin and I'm playing with the for loop, in Kotlin Script (*.kts file) I have this in the file:
for (i in 1..5) print("$i, ")
I did think it would print the number 1 through 5 separated by commas in one line like this:
1, 2, 3, 4, 5,
But instead I don't get any output on the command line. I'm running this on a Mac via
kotlin ranges.kts
If I put anything behind this single for loop, like a seperate println() or if I replace the print in the loop with println, it works and gives me output.
I don't get this behaviour. Can anyone explain this to me?
Edit1: Versions: kotlin: 1.3.71 MacOS 10.15.4 (Catalina)
1, 2, 3, 4, 5, ##scratch##generated##kotlin.Unit