A flag or switch is basically any value or set of values that activates an event. For example, a certain flag needs to be checked in Pokémon Emerald to be able to ride the ferry in Slateport City to Birth Island and simply having the AuroraTicket won't work.
Another example of flags in action is how the registered 'seen' and 'own' Pokémon in the Pokédex works. Here, binary switches are used for a total of 19 'seen' bytes [D30A-D31C] (the bytes are offset by -1 in Yellow) and a total of 19 'own' bytes [D2F7-D309]. Bulbasaur's seen flag is a value of bin:01 in D30A (2^0), while Ivysaur's own flag is bin:10 (2^1) in D2F7.
Let's say you have seen only Bulbasaur, Charmander and Squirtle. The hexadecimal value for this would be 2^0 + 2^3 + 2^6 in D30A (note that the powers indicate the bits), which equals 49 in hexadecimal (or 73 in decimal).
- Glitch Pokédex flags