The following code works perfectly
However, when I break this into different lines, it stops working. Moreover, the braces appear to be pink or red
For [ i=1,i<4,i++, Print[i] ]
Why is this happening?
This happens because the expression
is complete at the location of the newline. Mathematica will not attempt to read further. Instead, it will try to interpret the next line as the start of a new expression.
Compare this with
which is incomplete at the newline. Mathematica will read further to try to complete it.
For[ i=1, i<4, i++, Print[i] ]