+ 1

wht is the main idea of looping?

27th Jan 2017, 8:19 PM
Edûuh Mûraya
Edûuh Mûraya - avatar
4 odpowiedzi
+ 5
loops repeat an action until you stop them with a condition(if not they would run forever). They are really useful for not have the same code many times, for example if you want to print something a number of times you will use a loop that ends after a counter that increases every time you make the action reaches that number or something like that. They are really useful in my opinion 😉
27th Jan 2017, 8:53 PM
C.E.
C.E. - avatar
+ 1
//More efficient also, better in checking values and comparing them. //Here is an example: cout << "Hello World!" << endl; cout << "Hello World!" << endl; cout << "Hello World!" << endl; cout << "Hello World!" << endl; cout << "Hello World!" << endl; //This is way better for (int i = 0; i < 5; i++) { cout << "Hello World!" << endl; }
27th Jan 2017, 8:52 PM
Dawzy
Dawzy - avatar
0
just learn it, you will get the point eventually. I promise it's important and usefull to learn.
27th Jan 2017, 9:00 PM
Yuliana
Yuliana - avatar
0
As stated above, loops are useful and have purpose. Shortening your overall code is definitely a good reason. Depending on the function of your code, your entire program maybe a large cycle to enumerating through a database. As your skills and experience in development increase, you will understand the need and find uses for loops.
29th Jan 2017, 3:51 PM
Larry James Hobbs Jr.
Larry James Hobbs Jr. - avatar