Having multiple return statements like that has no effect on the stack, the return statement only comes into play when it is executed.
However it's a programming style question that comes up now and again and one I contemplate again and again.
When I see horrible code like this:
Code:
IF A THEN
IF B THEN
IF C THEN
IF D THEN
do something
END IF
END IF
END IF
END IF
I want to change it to
Code:
IF NOT A THEN
RETURN
IF NOT B THEN
RETURN
...
etc
because from a debugging and comprehension standpoint I find it easier to be able to get out of the processing chain as soon as possible. I don't want to have to work through all those nested IFs wondering what's going to happen next.
It's easier for me to read, write and test.
Bookmarks