Does anyone how to end a subclass?

I have a subclass with an if else loop.
But now I want when the else loop is activated, it need to end that subclass.