what is loop and it's types | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is loop and it's types

17th Jul 2016, 4:45 PM
Pulkit Khandelwal
Pulkit Khandelwal - avatar
3 Answers
+ 1
There is for loops, while-do loops, do--------while loops, lots of loops. The best way to learn them is to go through this app and just learn them. Theyre taught early on so it shouldn't take too long to get to them.. While-something is true-do loops do something until it is not true. For i=0, i<5, i++ do System.out.println(i); <-- this means i starts at 0, then IF i is under 5 it will add one to i (this code here will repeat 5times) the for code may have an error or two because I've finished the app, but haven't been able to use any of this yet, as I need to review and learn more. Do----while loops means it will do whatever is after do atleast once, then it will check while, for example: do System.out.println("Hi") while (something true/false here). If it is false, it will print Hi once before having checked it.
19th Jul 2016, 9:13 AM
Tristan
0
loop is used to perform certain task for a number of times types for while do while for each
6th Aug 2016, 4:37 PM
sachin tomar
sachin tomar - avatar
0
there are 3 types of loops for,while and do while loop for(initialization;condition;increment) followed by statement. while (expression)followed by statement. do statement while (expression) the mai difference in do while loop is that it is evaluated atleast once even if the condition is false.whic is not the case in for and while loop
16th Aug 2016, 5:17 PM
rajat kumar raicha
rajat kumar raicha - avatar