Comparisons Conditions

Script Boolean Comparisons

Boolean comparisons are used to compare two boolean (true/false) values. To test if they are both true or if just one of them is true.

&& • And. Both the first and the second values are true.

var A=6;
var C=A>0&&A<10;

var D=true,E=true;
var F=D&&E;

|| • Or. The first or the second value is true.

var A=6,B=7;
var C=A==6||B==6;

var D=true,E=false;
var F=D||E;

! • Swap a boolean value between true and false.

var A=false,B=true;
var C=!A;
var D=!A&&B;

var E=6,F=7;
var G=!(A==5&&B==5);

Comparisons Conditions