+ 2

is it good to use more than 10 nested loop?

is it good to use more than 10 nested loop?

23rd Feb 2017, 11:50 AM
hargun das
hargun das - avatar
6 Antworten
+ 11
You know there is an easier way when you need 10 nested loops.
23rd Feb 2017, 2:24 PM
Hatsy Rei
Hatsy Rei - avatar
+ 3
You've asked this question twice (3x counting here). Will there be 8/7 more? :) While I offer the "These go to 11 meme"... I'll just pop off to see what happens to the stack this deep. I'll be back.
28th Feb 2017, 3:57 PM
Kirk Schafer
Kirk Schafer - avatar
+ 3
Okay... the key phrase appears to be "nesting limits" (depth), for example CUDA/GPU's: https://msdn.microsoft.com/en-us/library/windows/desktop/bb172933(v=vs.85).aspx (request 'desktop site' on mobile) Depending on the language/context...like SQL (depth 12?) or Excel (used to be 8) or C++ (256, 1024)... it's not illegal to deeply nest, so someone somewhere might have a use for it, perhaps in science or physics. Note that depth can increase unexpectedly (sample "if" and switch optimization): http://codebetter.com/patricksmacchia/2008/03/07/a-simple-trick-to-code-better-and-to-increase-testability/ --> "when a switch on a string has more than 6 cases, the C# compiler estimates that it is worth creating a generic Dictionary<string,int> and to do the switch on the hash value of the string. " It has security implications from a DoS standpoint, but here...? I'd refactor.
28th Feb 2017, 4:39 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Yes ,You can use it but if you want to do the program within time limits then its not a good idea but if your program really needs them then u must use them.Rather than using them you can try them using recursion. Hope this info helps!!
23rd Feb 2017, 11:53 AM
G Hemanth
G Hemanth - avatar
+ 1
No. You will easily make mistakes and you will not be able to effectively test all the possible permutations. Sounds like you need to refactor your code.
23rd Feb 2017, 11:55 AM
Jehad Al-Ansari
Jehad Al-Ansari - avatar
0
why not..
23rd Feb 2017, 5:52 PM
meherDev
meherDev - avatar