• One thing I always try to do is add a comment at the start of a "programming block" -- BEGIN, IF, ELSE, WHILE. It really helps when reviewing code to have a quick comment on what's going on in this IF block, or what occurs in each iteration of the WHILE loop.

    Here's an outline. (Please note that I do indent my code; I've yet to figure out how to get this forum to accept leading spaces on new paragraphs.)

    IF <someCondition>

    BEGIN

    -- Description of conditions causing this IF code to run

    END

    ELSE

    BEGIN

    -- Description of conditions causing this ELSE code to run (very useful if the IF clause is fifty lines back)

    END

    ENDIF