Merged exit condition of the loop