• vaionko@sopuli.xyz
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    11 hours ago

    You don’t comment what something does, ir can clearly be seen from the code itself. You comment why you do it.

    • Gumby@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 hours ago

      “Clearly” is also subjective. What might be perfectly clear to me reading my own code may be really confusing to someone else, and vice versa. Especially if the person reading the code isn’t as familiar with the language as the person who wrote it, or if the code is using some syntactic sugar that isn’t super common, or plenty of other reasons.

      • vaionko@sopuli.xyz
        link
        fedilink
        arrow-up
        1
        ·
        2 hours ago

        True. It’s more like there’s no need to comment an if statement with “checks if a is larger than b”