Often when you write code, you want the same block of code to run over and over again a certain number of times. So, instead of adding several almost equal code-lines in a script, we can use loops.
while - loops through a block of code as long as the specified condition is truedo...while - loops through a block of code once, and then repeats the loop as long as the specified condition is truefor - loops through a block of code a specified number of timesforeach - loops through a block of code for each element in an arrayEdit the code below and click Run to see the result live.