Your question isn’t clear. What exactly do you want the function to do, and what does ‘stop the one before it’ mean? Also show how you’re calling these functions. Without that, it’s hard to give a useful answer.