print(_:separator:terminator:) strange behaviour in Playgrounds 4

for n in 1...5 {

    print(n, terminator: "")

}

The output is

1
2345

The output is not "12345", as expected. Terminator doesn't work on first iteration inside a for. The error happens randomly and only on first loop. Why?

Playgrounds - Version 4.0 (1567.22) on iMac 27'' 5k late 2017

Replies

I get the same.

Did not occur on iPad Swift playgrounds 3.4.

So, looks like a bug.

  • Happens to me also on iPadOS 15.4.1, swift 5.5 (playgrounds). I have also been trying to print numbers in a square grid, with format %02d, and a " " separator. Does not work, no separator.

Add a Comment