A for loop is a type of repetition control structure that allows us to create a loop that will be executed a predetermined number of times. The loop enables us to perform n steps in a single line. A “For” Loop is used to repeat a specific block of code a set number of times.
The for statement allows you to specify the number of times a statement or compound statement should be repeated. A for statement’s body is executed zero or more times until an optional condition is met.