Some people use tabs to indent, while others use spaces. If you use spaces, make sure that you use a consistent number of spaces; for example, four for each indent. You should indent any time you use a statement that contains a block of code, such as an if statement or a for loop. This will help you tell which block a statement belongs to, and match it to its closing brace (}). Indenting isn't always necessary—it's pretty much a personal preference. Technically, the code runs the same with or without indenting, but it makes good sense to invest the time to do it.

Was this article helpful?

0 0

Post a comment