146k views
3 votes
Why you should you indent the statements in the body of a loop?

User BadCanyon
by
7.6k points

1 Answer

3 votes

Indenting is a visual way of representing blocks of code. In the case of a loop (but also applicable to conditional statements like if statements). It allows you to easily see to where the looped code extends. In most languages (python being a notable exception), the indenting is not important for correct compilation.

User Pieter Ennes
by
8.5k points

No related questions found