For loop sets condition variable initialization and modification on one line.
initialization - sets variables used in the loop (like $i = 0
)
condition - Until when the cycle will keep on executing. Like $i <= 10
.
modification - could avoid infinite loops (like $i++
).
Let's have a program that prints each number from 1 to 10.