The code inside checks the number of costumes a sprite has by cycling through every costume (starting from costume 1) until cycling back to costume 1. You can see this in action by pressing the green flag.