break void function when the condition is met