Break activity in an IF function

but its not working in do while and while loop , check this question i recently added