Use MAJOR Comments Within Nested Block Scopes [DS5] [WHAT] [WHERE]
Tip DS5
A common point of confusion is whether or not you can use MAJOR comments within an indented "block" of code within something like an if statement or loop. The answer is that yes, you can.
Any time you enter a new "block" or "indented" scope, you can "restart" using MAJOR comments. For example, if you're using MAJOR comments in a function and then you enter the body of an if statement, while loop, or some other indented block of code (often surrounded by curly braces), you can use MAJOR comments within that new block scope to identify MAJOR steps:
Some of the reason for this is practical - being able to leverage the benefits of MAJOR comments in contrast to regular minor comments within indented block scopes. But you can also think of entering a new block scope a bit like entering a new context (like a new stack frame being pushed onto the stack for a function call), and the extra indentation provides a clue to the logical organization of the code. In summary:
At a given indentation level, multiple sequential “paragraphs” of code should be at the same conceptual level. MAJOR comments help identify these.
When you enter a new level of indentation, the code is now at a slightly different conceptual level than the broader, surrounding code. Thus it’s appropriate to leverage MAJOR comments to identify the major steps within that indented block.
Below is an example demonstrating MAJOR comments within some indented blocks: