> In my example if the first expression returns with false no other iteration made just return with the predefinied null variable.

True, but I was trying to merge your example with what I have seen in the codebase, sorry if that came across the wrong way.

> I really hate negated expressions and mid-block returns but this is not my code I just wrote some plugins to fit RC in my environment.

The way I'm applying them right now, I don't particularly enjoy them either, but I do think they're the lesser of two evils. As discussed before - what you want to have, in the end, is a separation into functions. I think disentangling those large if statements is a good first step towards that.

-David


On Thu, Sep 5, 2013 at 11:55 AM, Sandor Takacs <taki@alkoholista.hu> wrote:
2013-09-05 11:09 időpontban David Deutsch ezt írta:


Not sure about that. In some cases I have seen so far, there were quite a number of elseifs. My goal was to get out of the function as soon as possible - continuing to iterate through all the cases you already know won't apply doesn't seem like a good use of resources to me.

In my example if the first expression returns with false no other iteration made just return with the predefinied null variable.


I also don't think that part of it was controversial - it was more about that up until now, returns were in general either at the start or end of a function and what I introduced used some more in the middle of a function. So in your example, you would still kinda-sorta hunt for where the $return is set in the first place.

I really hate negated expressions and mid-block returns but this is not my code I just wrote some plugins to fit RC in my environment.


--
Takika

_______________________________________________
Roundcube Development discussion mailing list
dev@lists.roundcube.net
http://lists.roundcube.net/mailman/listinfo/dev