+ 4

Pls explain me about loops!!!

28th Dec 2016, 1:09 AM
SAGAR SINGHA ROY
SAGAR SINGHA ROY - avatar
3 Antworten
+ 3
for (initialization; condition; change) { body } First the "initialization" is done. Then the "condition" is checked. If the condition is true, the "body" of the loop is executed. If not, control passes to the statement (if any) directly after the body of the loop. After the body is executed, the "change" is done. This can be increment, decrement of the initialized variable(s) or something else. Now the condition is checked again & the procedure repeats as before. Observe that this is just like the while loop as shown below. initialization; while (condition) { body; change; }
19th Jan 2017, 12:10 PM
Dhaval Furia
Dhaval Furia - avatar
+ 2
Loops repeat an action for example: ( I'll use a for loop): for (amount of time that usually uses a variable) { //do something }
30th Dec 2016, 2:14 AM
Cherry
Cherry - avatar
0
if we wants to do the same work repeatedly then loops are used
19th Mar 2017, 5:15 AM
SHOBH NATH RAI
SHOBH NATH RAI - avatar