Yesterday I was reading the latest actionscript 3 documentation on adobe labs and I found that they finally introduced the … (rest) function’s argument, as also described in the ECMA Script 4 specifications.
I say “finally” because it’s since I discovered python *args and **kwds function arguments that I pray for them also in actionscript.
In actionscript3 rest parameter is used for example:
public function log(message:String, ... rest):void
logging.text += message + "\n";
for(var i:uint = 0; i < rest.length; i++)
logging.text += rest[i] + "\n";
log("hello", "spammed", "world");
The reference says about the rest parameter: specifies that a function will accept any number of comma delimited arguments. The list of arguments becomes an array that is available throughout the function body.
Now I just will wait till they will intoduce also the **kwds python equivalent parameter and I will an happy man! 🙂
Read more here