hello there! I hope you well and good, God bless you and you got everything that you once wish it. when we listen loop we suddenly relate with ourselves because our life is also an loop where in these loop we wake up, fresh, take breakfast, go for work, take lunch, come home, take dinner, sleep do these everyday that we called loop of life.
in computation term loop is running n of iteration and done the work. there are 3 ways to we can run an loops:
- for
- while
- do while
⁕ for loop's syntax,
for(iteration; condition; increment){
statement :
}
ex,
for(int i=0; i<5; i++){
print("hello world");
}
⁕ while loop's syntax,
while(condition){
statement :
}
ex,
int i=0;
while(i<5){
print("hello there! how are you?");
i++;
}
⁕ do while loop's syntax,
do{
statement :
}while(condition);
ex,
int d;
do{
print("keep code, keep shine");
d++;
}while(d<5);
here how we learned loops. stay connected, stay focus, stay active...
Top comments (0)