...rest parameter

64 views
Skip to first unread message

singuerinc

unread,
Oct 13, 2011, 7:07:01 PM10/13/11
to General Dart Discussion
Hello,
In ActionScript 3 we have a "rest" parameter, this means that you can
pass from 0 to n values to the function. Like this:

public function doSomething(...rest):void{
trace(rest.join('-'));
}

doSomething(25, 'Hi', 'Ciao');
//or
doSomething('One');
//or
doSomething();

There is some kind of this in Dart?
Thanks

Florian Loitsch

unread,
Oct 13, 2011, 7:38:54 PM10/13/11
to singuerinc, General Dart Discussion
We had it initially and removed it when we added named arguments. The decision is not final, and we might eventually add it back. For now we are testing the language without it.
// florian
--
Give a man a fire and he's warm for the whole day,
but set fire to him and he's warm for the rest of his life. - Terry Pratchett
Reply all
Reply to author
Forward
0 new messages