Quote:
Originally posted by GregorK The code is some times nested up to 8 levels or maybe more. In almost every style guide you will read that you should not use more then 3 or maybe 4 levels. Instead try to use sub method calls. This makes things much easier to read and understand.
Also you can sometimes limit nesting with reversing the condition.
Instead of saying:
If example = True Then
If example2 = True Then
...... VERY LONG CODE LIST.....
end if
end if
you can say:
If example = False Then
return
end if
If example2 = False Then
return
end if
...... VERY LONG CODE LIST.....
Don't know the exact syntax but I hope you understand my intention. |
Just a matter of style I guess .. I actually dont like multiple returns/exit points (however i do have some!) ... and normally would write code like the first example to avoid it !
However I do have to many nested If/Thens .. or flying ducks
Joe