Syntactic sugar for array index acces, instead of ar.get(0) say ar[0], and instead of ar.set(0, val) say ar[0] = val;

Indexers are now syntactic sugar for .get and .set calls, respectively. That means:

var ar = [1, 2, 3];
ar.set(0, 1); // is equivalent to:
ar[0] = 1;
// and
log(ar.get(0)); // is equivalent to:
log(ar[0]);
But this also works with the Map type:
var dat = Map<String, Object>();
dat["name"] = "Zef Hemel";
dat["age"] = 27;

Naturally, this also works for custom types.

Submitted by Zef Hemel on 11 April 2011 at 11:01

On 11 April 2011 at 11:02 Zef Hemel tagged 0.4.3

On 11 April 2011 at 11:02 Zef Hemel closed this issue.

Log in to post comments