That particular example doesn't work: You increase the variable until 9, and then zero it out. It never reaches 10, so your if clause will never get invoked.
the principle is OK, but the numbers need a tweak.
the principle is OK, but the numbers need a tweak.