Well... Code without braces may look a bit confusing, but that depends
on what somebody is used to and just what you like. An example when I
often bypass braces is setting default values for AS2 function
arguments:
function funName(arg1:Number, arg2:Object):Object
{
if(isNaN(arg1)) arg1 = 0;
if(arg2 == null) arg2 = {};
//... rest of code
}
This has no sense in AS3 because it provides a new syntax for setting
default values fun(arg:Number=0):void.
Another example:
function funName2(flag:Number):Number
{
if(isNaN(flag)) return someValue;
return someOtherValue;
}
You mention using braces without somewhere to emphasize the code. I
think it is just somebodies preference how he highlights separated
logic
Usually separated logic should be done just by writing a separate
method but when there are performance issues (calling a new method
leads to redeclaration of variables) or when this part of code sets a
group of new variables (separate method returns only one value, unless
it returns an array or object - again performance issue), this may
have sense. Still, I prefer adding a commented bar or a short limerick
instead or braces.
Greg
Wednesday, December 09, 2009 (6:18:42 AM):
> Yes, your correct.
> I always use braces.
> It looks aesthetically pleasing to me and helps me separate things.
> BTW, what is the point of braces if you dont need them, except the
> separation of your code part.
> Are they needed in some situations over others?
> Karl
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders