I am getting error for this syntax
for (i in 0 until 8) {
for (j in 0 until 8) {
} println()
}
error is
For is not an expression, and only expressions are allowed here.
but this is valid
for (i in 0 until 8) {
for (j in 0 until 8) {
}
println()
}
only thing I changed was where println() is called, I have worked with java so I thought that placement should not matter. What is the issue here ?
println()is on its own line, despite the fact you can make the first approach work with a semicolon. The second approach is more idiomatic and thus more readable.