Breaking if statements with pattern