+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
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 (
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
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;
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 &&
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
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-
Hi,
I prefer:
if (giveItName()) {
….
}
giveItName() {
return condition1 && condition2 && condition3;
}
Thanks,
Justin
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
& 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
10 matches
Mail list logo