var motto:Array = [ "rock", "on", ];
When adding/removing an element in an array, how many times do you find yourself having to deal with the nuisance of adding/removing the comma of the last array element? Well not anymore. In AS3, you are allowed to leave your comma for the last element in. Perl coders have been able to do this for years, finally Actionscript coders can too.

4 Comments:
Can you explain a situation where there would be an extra comma? I don't think I've run into that before.
One instance is when you have an array of long strings, where you format things to be one string per line for readability.
e.g.
var countryName:Array = [
"Tahiti",
"Jamaica",
"Bahamas"
];
Oh I see what you mean now. So the compiler's OK with the extra comma and doesn't create a null item on the end of the array ?
Yes you got it.
Post a Comment
<< Home