If you are writing some code and need an event to occur only when some other event has occurred or a specific condition has been met, an if-then statement might come in handy.  Explore how these work in the Arduino IDE: