Looks like JavaScript, feels like Ruby, and it is a script language fitting in C programmers.
This project is maintained by Kray-G
Postfix operator is below.
.
, []
, ()
, ++
, --
.
expression . property
… Operator Dot, means searching a property’s value by name. This is actually same as expression [ "property" ]
.expression [ expression ]
… Operator []
, means array/binary/string access by index or searching a property’s value by the value of expression.expression ( arguments... )
… Operator ()
, means function call with arguments.expression ++
… Operator Postfix Plus Plus, means a prefix increment, and the result will be the value before evaluated.expression --
… Operator Postfix Minus Minus, means a prefix decrement, and the result will be the value before evaluated.And also the operator of .
and []
can be l-value like this.
a.prop = 100;
b[1] = 20;
.
var obj = { a: 100, b: 200, c: 300, d: 400 };
System.println(obj.a);
System.println(obj.b);
System.println(obj.c);
System.println(obj.d);
100
200
300
400
[]
for arrayvar ary = [1000, 2000, 3000, 4000];
System.println(ary[0]);
System.println(ary[1]);
System.println(ary[2]);
System.println(ary[3]);
1000
2000
3000
4000
[]
for objectvar obj = { a: 100, b: 200, c: 300, d: 400 };
System.println(obj["a"]);
System.println(obj["b"]);
System.println(obj["c"]);
System.println(obj["d"]);
100
200
300
400
function f(...arg) {
System.println("f was called with ", arg);
}
f(1, 2, 3, 4, 5, 6, 7, 8);
f was called with [1, 2, 3, 4, 5, 6, 7, 8]
++
function test(a) {
var b = a;
System.print([b, a++]);
System.println(" => ", a);
}
test(97);
test(2 ** 70);
test(-(2 ** 70));
[97, 97] => 98
[1180591620717411303424, 1180591620717411303424] => 1180591620717411303425
[-1180591620717411303424, -1180591620717411303424] => -1180591620717411303423
--
function test(a) {
var b = a;
System.print([b, a--]);
System.println(" => ", a);
}
test(97);
test(2 ** 70);
test(-(2 ** 70));
[97, 97] => 96
[1180591620717411303424, 1180591620717411303424] => 1180591620717411303423
[-1180591620717411303424, -1180591620717411303424] => -1180591620717411303425