eliminate a fuction

You can break out of loops, but not really functions. What is your use case?

You can put a boolean check in your function to decide whether to move forward, or destroy the UObject that’s performing the function (which may end in a pending kill without terminating execution), or just rewrite your logic so that you don’t have to kill your function execution.