Maybe you need to assign a value to your B variable before UNTIL . So that B can reach 16. Tell us what is that B variable ?