it's preferable to not have additional conditions in the third clause of the for loop here. instead use a break to exit the loop.