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???
7 Respostas
+ 1
Use "break" or "continue" keywords to operate loop flows.
+ 1
Super bro.... Else format is also awesome
0
We need to reduce count of loop dude.
0
Super dude getting some idea
- 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
- 1
You can just set needed number in counter then. Example:
for (int i = 0; i < 10; i++) {
...
if (somethingHappened()) {
i = 8;
}
...
}
- 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;
}
}