0
what is loop and it's types
3 Respuestas
+ 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.
0
loop is used to perform certain task for a number of times
types
for
while
do while
for each
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