+ 3
Please explain the loop further with the given example in tutorial
4 ответов
+ 5
huh
+ 3
int main() {
int i = 0; //declaring and initilize variable i (why i ? for short loop, i is often used. it is some convention among programmer.)
while(i < 3) // set the condition if value i is less than 3, then the code below is executed :
{
cout<<i; // print out i
i++; // increment i
}
return 0;
}
you can copy that to codeplayground.
change the value of i like 1 or 2, or change the condition like i < 10 or i < 7. more practice better understanding.
+ 2
while loop
+ 1
there are many loops. which one?