+ 1

Should Nested for loops be avoided?

Some times, nested for loops produce desired output. But, it looks odd when nested for and if we're used.

3rd Jul 2019, 2:22 PM
Ragacibi M
Ragacibi M - avatar
2 Respuestas
+ 2
You can't really prevent nesting and therefore indentation. I feel that 5 or 6 levels should be the limit. If you move further to the right, you should think about restructuring the code somewhat, for example using functions.
3rd Jul 2019, 3:38 PM
HonFu
HonFu - avatar
5th Jul 2019, 1:50 PM
Ragacibi M
Ragacibi M - avatar