Why is for loop not working among the phrases listed in a line? Perhaps this question is related to Python's grammar. Please excuse me.
Examples 1,2,4 work. However, Example 3 creates a grammar error.
In particular, examples 2 and 3 have exactly the same statement except that they were line up on single line using semicolons, so why doesn't example 3 work only?
# example 1
import bpy
bpy.context.view_layer.cycles.use_denoising = True

# example 2
import bpy
print(&quot;one line for loop&quot;)
for i in bpy.context.scene.view_layers : i.cycles.use_denoising = True

# example 3
import bpy
print(&quot;one line for loop&quot;); for i in bpy.context.scene.view_layers : i.cycles.use_denoising = True;

# example 4
import bpy
vl = bpy.context.scene.view_layers; check = True;
print(&quot;one line multiple statment&quot;); vl[0].cycles.use_denoising = check; vl[1].cycles.use_denoising = check; vl[2].cycles.use_denoising = check;
Semicolon cannot be used to separate 8. Compound statements — Python 3.8.6rc1 documentation. Only simple statement are allowed.
And the one-line for statement will probably confused with Comprehensions:
print(x) for x in range(20)  
print(x); for x in range(20): pass

Why can't use semi-colon before for loop in Python? - Stack Overflow
bash - Python command line argument semicolon-loop error - Stack Overflow