There is a large debate in the programming community about how things should be indented, but there is a simple solution.
A part of the original ASCII character set (character code 9
in ASCII, U+0009
in unicode), originiating from the days of typewriters and still existing to this day, the simple horizontal tab is a character which was created with only one purpose - indentation.
By standardizing on tabs, a few problems are solved.
The only two main issues with tabs are because some people didn’t consider some use cases, or were just lazy.
Some editors do not support variable tab widths. This can be an issue with languages only supported with these editors, but it is a non-issue for most of the community. For the people who use editors that do not support variable tab widths, still try to use tabs, because standards are better not fully supported than ignored.
Also, some editors only support using spaces for indentation, and will insert spaces even when you press the TAB
key, but in most cases the editor can be patched to fix this or a different editor can be used.
Because people don’t always use tabs (even though they should), some interpreters do not support them (I recently ran into this with Home Assistant’s YAML interpreter, for example). This could be fixed by things just supporting tabs, so if you ever run into things that don’t support tabs and are able to fix them, do.