[RESOLVED] [2005] # of nested program control statements - Rule of Thumb?
Hi all,
I'm asking because I recently download some sample code from somewhere where there were so many nested statements that a lot of the code was running off the right side of the screen.
I'm guessing there may be some times where you need a number of nested statements but is there some sort of rule of thumb: I have # many nested control statements so I should probably rethink my code because that is too many?
Thanks for any insight.
Re: [2005] # of nested program control statements - Rule of Thumb?
You should always write code that is as readable as possible without compromising performance. If the indenting of nested blocks is making your code less readable then you should consider alternatives, like moving the contents of some blocks to their own methods.