Using the (… args) Operator.

The usage is so simple and clear. Using this operator we can pass n number of variables values and hold them for calculation.The variable can be of any type and the final args contains the array of elements we pass.the below example will make you clear.

Flex Code Example:

CreationComplete=”init()” –>Call this on Application creation.

scrpt Code

private function init():void
private function average(… args):Number
var sum:Number=0;
var i:int;
return sum/args.length;

MXML code

<mx:Label id=”lbl” />

Enjoy the Post and Operator. Make your code simple. 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: