while (...) { if (matching) { # do stuff last; } }