Use a return statement.
If you are having an infinite loop inside,it may also cause a never ending function. Use "break" in that case.