3. Working with indentation in text blocks
Indentation in text blocks is easy to understand if we have a clear picture of two terms:
- Incidental (or unessential) white spaces – represent the meaningless white spaces that result from code formatting (leading white spaces commonly added by the IDE) or are added intentionally/accidentally at the end of the text (trailing white spaces)
- Essential white spaces – represent the white spaces that we explicitly add, which are meaningful for the final string
In Figure 1.3, you can see the incidental versus essential white spaces in a JSON text block:
Figure 1.3: Incidental versus essential white spaces in a JSON text block
In the left figure, you can see the incidental versus essential white spaces when the closing delimiter is placed at the end of the content. In the middle figure, the closing delimiter was moved to its own line, while in the right figure, we also shifted to the left.
...