Loops allow us to repeat a piece of code with the desired number of iterations. Basically, keep doing something until the condition no longer evaluates to true.
There are different types of loops:
- For loop. Performs a set of statements for each item in a set of records.
- SOQL for loop
- Java-like for loop
- While loop
- Do… while loop