# Unity Coroutine Notes ## Exiting Scopes To exit a coroutine early, you can use `yield break;`, but if you just want to exit a loop or something, but still allow the coroutine to continue executing beyond the inner scope, you can just use `break;`. ### Cleanup It's good practice to close out coroutines that may or may not be running with something like: ```C# private void CleanUp() { if (_myCoroutine != null) { StopCoroutine(_myCoroutine); _myCoroutine = null; } } ``` #unity #c_sharp