Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
it works because you return early if you find the result, otherwise the methods last line is return nil
If the code runs correctly, it will return said pair and end execution. If it doesn't find the pair, it will continue running until it finds this "return nil" statement. In this case, the description specifies you should return nil when no pair is found, so this does right that.
Hope I was of help.