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
so if you do use this style, could you try to remember to add a comment after the do? do // while-false { Note that once you reversed the logic of the if conditions, you could also code this section as an if-else chain. if (prompt == null); else if (prompt == ""); else if (!skin); else if (

Re: do-while-false

2015-11-19 Thread Harbs
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(!sk

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;

Re: do-while-false

2015-11-19 Thread Maxim Solodovnik
ak}; > if(prompt == ""){break}; > if(!skin){break}; > if(!skin.currentState){break}; > if(skin.currentState.indexOf("WithPrompt") == -1 && text.length != 0 || >skin.currentState.indexOf("WithPrompt") != -1 &&

RE: do-while-false

2015-11-19 Thread Kessler CTR Mark J
eak}; if(!skin){break}; if(!skin.currentState){break}; if(skin.currentState.indexOf("WithPrompt") == -1 && text.length != 0 || skin.currentState.indexOf("WithPrompt") != -1 && text.length == 0){break}; invalidateSkinState() break; } while(false); -Mar

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-

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
do something > } > } > } > } > > Both of these are kind of hard on the eyes and make fixes error-prone. > > The do-while-false solution is much more ledgible than both of these and > it goes like this: > > do{ > if(!conditiona){break}; > if(!conditi

do-while-false

2015-11-19 Thread Harbs
& conditionc &&conditiond( { //do something } or: if(conditiona){ if(conditionb){ if(conditionc){ if(conditiond){ // do something } } } } Both of these are kind of hard on the eyes and make fixes error-prone. The do-while-false solution is much more ledgibl