A common coding structure is the while loop. This is used when you need an action or event to occur for the entire time a condition is met or another action is occurring, but not at other times. To understand this in more depth, watch this video and learn about while loops in the Arduino IDE.
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:
There are a few programming structures that are common across languages. For-loops are one of those. For loops are commonly used when an action needs to be performed a specific number of times.
Take a look at this video to begin to learn to build a working for-loop using the Arduino IDE.