• SocialMediaRefugee@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 year ago

    Yes, two of the most important things I see comments do is explain things like boundary conditions, "This is why we stop at 50 here." and historical reasons "We have to return a 1 here because we still use calling func FOO for all of our calls still and it expects 1 as the default…"

    Another helpful use is to describe the expected format of the input. "We expect a struct with this format here…" Stick in a small example too. It makes it so much easier to quickly scan the code's flow.