Execute blocks of code repeatedly using for, while, and do-while loops.
Loops are fundamental for automation and iteration. The `for` loop is ideal for situations where you know the number of iterations beforehand. It consists of three parts in its header: initialization (executed once before the loop starts), condition (checked before each iteration), and increment/decrement (executed at the end of each iteration). For example, `for (int i = 0; i < 5; i++) { ... }` will run the loop body exactly five times. The `while` loop is more suitable when the number of iterations is not known in advance, and the loop continues as long as a certain condition is met. The syntax is `while (condition) { /* loop body */ }`. The condition is checked at the beginning of each iteration. If it's initially false, the loop body never executes. The `do-while` loop is a variation of the `while` loop. Its syntax is `do { /* loop body */ } while (condition);`. The key difference is that the condition is checked at the *end* of the iteration. This guarantees that the loop body will be executed at least once, regardless of whether the condition is initially true or false. This is useful for scenarios like prompting a user for input and validating it, where you need to get the input at least once.