Lets have this code in Kotlin:
fun main() {
println("Start")
var i = 1
while (i <= 10) {
Thread.sleep(500)
print("... ")
System.out.flush() // Suggest from another post, but it not working
i++
}
}
Why there is no output in console for 5 seconds and then everything is printed together in one go?
Start
... ... ... ... ... ... ... ... ... ...
I tried solution from How to make the print method in Kotlin have the same effect as Java, but it does not work.