0

How to use reduce loops flow??.

For example : if one logic will need a loop to run for 10 times. But for that logic we can easily get the output for flow of loop for two times??. how to reduce loop flow for getting efficient output???

28th Apr 2017, 4:01 PM
tharun
tharun - avatar
7 Respostas
+ 1
Use "break" or "continue" keywords to operate loop flows.
28th Apr 2017, 4:04 PM
Jeth
Jeth - avatar
+ 1
Super bro.... Else format is also awesome
28th Apr 2017, 4:14 PM
tharun
tharun - avatar
0
We need to reduce count of loop dude.
28th Apr 2017, 4:05 PM
tharun
tharun - avatar
0
Super dude getting some idea
28th Apr 2017, 4:09 PM
tharun
tharun - avatar
- 1
I too know of using continue and break statements let take a example of prime number 555643 to check it is prime are not loop should be used efficienctly
28th Apr 2017, 4:07 PM
tharun
tharun - avatar
- 1
You can just set needed number in counter then. Example: for (int i = 0; i < 10; i++) { ... if (somethingHappened()) { i = 8; } ... }
28th Apr 2017, 4:08 PM
Jeth
Jeth - avatar
- 1
or try incrementing it differently. examples: for (int i = 0; i < 20; i+=2;) { ... } or for (int i = 0; i < 20; ) { if (something) { i++; } else { i+=3; } }
28th Apr 2017, 4:12 PM
Edward