• ZILtoid1991@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    4 months ago

    Why is multiple levels of indentation bad?

    IDK, but if the reason is “to break stuff into multiple functions”, then I’m not necessarily writing yet another single-use function just to avoid writing a comment, especially in time critical applications. Did that with a text parser that could get text formatting from a specifically written XML file, but mainly due to it being way less time critical, and had a lot of reused code via templates.

    • theherk@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      Like with everything, context matters. Sometimes it can indicate poorly structured control flow, other times inefficient loop nesting. But many times it is just somebody’s preference for guard clauses. As long as the intent is clear, there are no efficiency problems, and it is possible to reach the fewest branches necessary, I see no issues.