Re: do-while-false

2015-11-20 Thread Mihai Chira
+1, as a class getter, an internal function, or even a local variable with a descriptive name. On 19 November 2015 at 09:44, Justin Mclean wrote: > Hi, > > I prefer: > > if (giveItName()) { > …. > } > > giveItName() { > return condition1 && condition2 && condition3; > } > > Thanks

Re: do-while-false

2015-11-19 Thread Alex Harui
I don't think there is any reason to mandate any particular style. If that's the way you want to write some code, that's fine with me. IMO, my brain thinks "loop" when it sees "do" as in, "something in here may need to be done more than once", so if you do use this style, could you try to remembe

Re: do-while-false

2015-11-19 Thread Harbs
Of course there’s no reason not to mix and match. In this case, I’d probably join similar conditions like this: do { if(prompt == null || prompt == "") break; if(!skin || !skin.currentState) break; if(skin.currentState.indexOf("WithPrompt") == -1 && text.length != 0)

Re: do-while-false

2015-11-19 Thread Harbs
To be clear, I think Mark’s code was a nice compromise between approach #1 and approach #2. In this case following Flex code formatting style, do-while-false should look something like this: do { if(prompt == null) break; if(prompt == "") break; if(!skin) brea

Re: do-while-false

2015-11-19 Thread Maxim Solodovnik
I believe example2 need to be reformatted to match example1 do { if(prompt == null) { break }; if(prompt == "") { break }; if(!skin){ break }; if(!skin.currentState) { break }; if(skin.currentState.indexOf("WithProm

RE: do-while-false

2015-11-19 Thread Kessler CTR Mark J
Let me see if I can reformat into all the examples so we can have a real sample for people. Below shows the original, what was committed. Then shows the last few examples. Hopefully this won't get word wrapped to badly or have font issues. The original was changed to better group the sets of

Re: do-while-false

2015-11-19 Thread piotrz
Hi Harbs, Really extraordinary way of use do-while. I love it and I'm ok with using it in invalidateSkinState! Thanks for sharing it! Piotr - Apache Flex PMC piotrzarzyck...@gmail.com -- View this message in context: http://apache-flex-development.247.n4.nabble.com/do-while-false-tp5

Re: do-while-false

2015-11-19 Thread Justin Mclean
Hi, I prefer: if (giveItName()) { …. } giveItName() { return condition1 && condition2 && condition3; } Thanks, Justin

Re: do-while-false

2015-11-19 Thread Maxim Solodovnik
I personally prefer if(conditiona && conditionb && conditionc &&conditiond) { //do something } it is shorter and more clear to me not sure about performance, but I guess "if(conditiona && conditionb && conditionc &&conditiond)" should produce better native code On Thu, Nov 19, 2015 at 2:16 PM, H