Looks like JavaScript, feels like Ruby, and it is a script language fitting in C programmers.
This project is maintained by Kray-G
Operators for equation are ==
and !=
.
var a = 0x05;
var b = a == 0x06; // 5 == 6 => false means 0
If the type is different, it will be compared after converting by the table below.
Inteer | Double | String | |
---|---|---|---|
Integer | Integer | Double | String by dec |
Double | Double | Double | - |
String | String by dec | - | String |
Comparing between Integer and String is done as stringified by decimal numbers.
==
for Integersfunction test(label, func, a, b) {
return ":: %8d %s %8d => %d" % a % label % b % func(a, b);
}
System.println(test("==", &(a, b) => a == b, 0x05, 0x06));
System.println(test("==", &(a, b) => a == b, 99, 99));
System.println(test("==", &(a, b) => a == b, 100, 11));
System.println(test("==", &(a, b) => a == b, null, 0x05));
System.println(test("==", &(a, b) => a == b, 0x07, null));
:: 5 == 6 => 0
:: 99 == 99 => 1
:: 100 == 11 => 0
:: ((null)) == 5 => 0
:: 7 == ((null)) => 0
==
between Integer and Doublefunction test(label, func, a, b) {
return ":: %8d %s %8d => %d" % a % label % b % func(a, b);
}
System.println(test("==", &(a, b) => a == b, 1, 1.0));
:: 1 == 1 => 1
==
between Integer and Stringfunction test(label, func, a, b) {
return ":: %8d %s %8d => %d" % a % label % b % func(a, b);
}
System.println(test("==", &(a, b) => a == b, 0xff, "255"));
System.println(test("==", &(a, b) => a == b, 0xff, "ff"));
:: 255 == 255 => 1
:: 255 == ff => 0
==
between String and Integerfunction test(label, func, a, b) {
return ":: %8d %s %8d => %d" % a % label % b % func(a, b);
}
System.println(test("==", &(a, b) => a == b, "255", 0xff));
System.println(test("==", &(a, b) => a == b, "ff", 0xff));
:: 255 == 255 => 1
:: ff == 255 => 0
!=
for Integersfunction test(label, func, a, b) {
return ":: %8d %s %8d => %d" % a % label % b % func(a, b);
}
System.println(test("!=", &(a, b) => a != b, 0x05, 0x06));
System.println(test("!=", &(a, b) => a != b, 99, 99));
System.println(test("!=", &(a, b) => a != b, 100, 11));
System.println(test("!=", &(a, b) => a != b, null, 0x05));
System.println(test("!=", &(a, b) => a != b, 0x07, null));
:: 5 != 6 => 1
:: 99 != 99 => 0
:: 100 != 11 => 1
:: ((null)) != 5 => 1
:: 7 != ((null)) => 1
!=
between Integer and Doublefunction test(label, func, a, b) {
return ":: %8d %s %8d => %d" % a % label % b % func(a, b);
}
System.println(test("!=", &(a, b) => a != b, 1, 1.0));
:: 1 != 1 => 0
!=
between Integer and Stringfunction test(label, func, a, b) {
return ":: %8d %s %8d => %d" % a % label % b % func(a, b);
}
System.println(test("!=", &(a, b) => a != b, 0xff, "255"));
System.println(test("!=", &(a, b) => a != b, 0xff, "ff"));
:: 255 != 255 => 0
:: 255 != ff => 1
!=
between String and Integerfunction test(label, func, a, b) {
return ":: %8d %s %8d => %d" % a % label % b % func(a, b);
}
System.println(test("!=", &(a, b) => a != b, "255", 0xff));
System.println(test("!=", &(a, b) => a != b, "ff", 0xff));
:: 255 != 255 => 0
:: ff != 255 => 1