Hello this is about repetitions in programs. A repetition is an integral part of a programming language. These repetitive operation or sentences are named as ”iterations”. An iteration means that a process is repeated again and again. To do this, the principal method is the loop which are commonly used in any programming work. Loops are used when wanting to reduce a process into simpler coding, when something has to be repeated on and on.  Loops are the basis of the repetition in any programming language.  There are different types of loops of course, like while, for etc.

 

While- a code of bock that uses a while has to include a condition to be valid and for it to compile and work correctly. They allow the program to perform a particular action while a set condition is true.

 

 

 


Break and continue- It can be used to end a loop before some condition. If you type continue, the loop continues to do its work, obviously.

 

This processes enables the programs to repeat an action as long as a particular set condition remains true.

 

A for loop is another kind of repetition when coding in c++. A for loop can provide the beginning of the loop, obviously a condition and updates like…

( i=0 ; i

 

 

 

 

 WATCH MY VIDEO  https://youtu.be/R6TX6gDnFhg

 

CC BY 4.0 #Mastery22 – When to use what type of repetition in a program by Ricardo Newton is licensed under a Creative Commons Attribution 4.0 International License.