Looks like JavaScript, feels like Ruby, and it is a script language fitting in C programmers.
This project is maintained by Kray-G
Unary operator is a prefix operator. Here is the unary operator’s list.
!, +, -, *, ++, --.
! expression … Operator Not, means it is evaluated as true when expression is false.+ expression … Operator Plus, do nothing so far.- expression … Operator Minus, means it makes expression negative when expression is positive.* expression … Operator Asterisk, means it is converted to other type depending on the expression’s type.++ expression … Operator Plus Plus, means a prefix increment, and the result will be the value after evaluated.-- expression … Operator Minus Minus, means a prefix decrement, and the result will be the value after evaluated.Note that the true and the false is defined just as Integer of 1 and 0 in Kinx.
var a = false; // false is just 0 as an integer.
var b = !a; // b => true, means 1 as an integer.
!System.println(!true);
System.println(!false);
System.println(!True); // True object.
System.println(!False); // False object.
0
1
0
1
+System.println(+true);
System.println(+false);
System.println(+True); // True object.
System.println(+False); // False object.
1
0
true
false
-function test(a) {
System.println(-a);
}
test(true);
test(false);
test(10);
test(2 ** 70 - 1);
-1
0
-10
-1180591620717411303423
*function test(a) {
System.println(*a);
}
test(97);
test([97, 98, 99]);
test(<97, 98, 99>);
test("ABC");
a
abc
abc
[65, 66, 67]
++function test(a) {
var b = a;
System.println([b, ++a]);
}
test(97);
test(2 ** 70);
test(-(2 ** 70));
[97, 98]
[1180591620717411303424, 1180591620717411303425]
[-1180591620717411303424, -1180591620717411303423]
--function test(a) {
var b = a;
System.println([b, --a]);
}
test(97);
test(2 ** 70);
test(-(2 ** 70));
[97, 96]
[1180591620717411303424, 1180591620717411303423]
[-1180591620717411303424, -1180591620717411303425]