I've noticed that if(){} statements seem to only execute once if they are out side a do or while loop.
Of course, anything in a loop will execute as many times as the loops executes. Nothing wrong with this. if(){} statements (and anything else) should execute as many times as the control flows through them.