Copyright 2010-2017 Obihai Technology, Inc.
130
Operator
Description
Examples
==
Syntax: OP1
==
OP2
Case-insensitve compares OP1 and OP2 and
returns "1" if the string is the same, or "0"
otherwise
(a==b) returns "0"
((a==b)==0) returns "1"
!=
Syntax: OP1
!=
OP2
Case-insensitve compares OP1 and OP2 and
returns "0" if the string is the same, or "1"
otherwise
(3!=0) returns "1"
>>
Syntax: OP1
>>
OP2
Right arithmetic shift OP1 by OP2 bits if OP2 > 0.
Otherwise left arithmetic shift OP1 by (-OP2) bits.
OP1 and OP2 are convertd to signed integers
before the shift. The result is always a numerical
string even if the amount of shift is 0
(3<<0) returns "3"
(3<<2) returns "12"
<<
Syntax: OP1
>>
OP2
Left arithmetic shift OP1 by OP2 bits if OP2 > 0.
Otherwise right arithmetic shift OP1 by (-OP2) bits.
OP1 and OP2 are converted to signed integers
before the shift. The result is always a numerical
string even if the amount of shift is 0
(3<=0) returns "0"
>=
Syntax: OP1
>=
OP2
Compare the numerical value of OP1 and OP2, and
returns "1" if OP1 is greater than or equal to OP2,
or "0" otherwise. OP1 and OP2 are converted to
signed integers before the compare.
(3>=0) returns "1"
<=
Syntax: OP1
<=
OP2
Compare the numerical value of OP1 and OP2, and
returns "1" if OP1 is lessr than or equal to OP2, or
"0" otherwise. OP1 and OP2 are converted to
signed integers before the compare.
(3<=0) returns "0"
||
Syntax: OP1
||
OP2
Logical OR the numerical value of OP1 and OP2,
and returns "1" if true, or "0" otherwise. OP1 and
OP2 are converted to signed integers before the
Logical OR.
(3||7) returns "1"
(1||0) returns "0"
??
Syntax: OP1
??
OP2
Return OP1 (unchanged) if it is not an empty string,
or OP2 (unchanged) otherwise
(3??2) returns "2"
(??me) returns "me"
&&
Syntax: OP1
&&
OP2
Logical AND the numerical value of OP1 and OP2,
and returns "1" if true, or "0" otherwise. OP1 and
(3&&7) returns "1"
(3&&8) returns "1"