//var to store our boolean let b; b = true; prn("#1: " + b); b = (1 === 1); prn("#2: " + b); b = (10 > 5); prn("#3: " + b); b = ('fancy' === 'fancy'); prn("#4: " + b);
//var to store our boolean let b; b = false; prn("#1: " + b); b = (1 === 2); prn("#2: " + b); b = (10 > 11); prn("#3: " + b); b = ('fancy' === 'hello'); prn("#4: " + b);
//var to store our boolean let b; b = true; b = !b; prn("#1a: " + b); //or we could flip like this b = !true; prn("#1b: " + b); b = 1 === 1; b = !b; prn("#2a: " + b); //or like this b = !(1 === 1) prn("#2b: " + b);
let b1, b2, b, isSaturday, isSunny, isSunnySaturday;
b1 = true;
b2 = true;
b = (b1 && b2);
prn("expecting true, actual is: " + b);
b1 = true;
b2 = false;
b = (b1 && b2);
prn("expecting false, actual is: " + b);
isSunny = true;
isSaturday = true;
isSunnySaturday = isSaturday && isSunny;
prn("Is it a sunny saturday? " + isSunnySaturday);
let b1, b2, b, isSaturday, isSunny, isSunnyOrSaturday; b1 = true; b2 = false; b = (b1 || b2); prn("expecting true, actual is: " + b); b1 = false; b2 = false; b = (b1 || b2); prn("expecting false, actual is: " + b); isSunny = true; isSaturday = false; isSunnyOrSaturday = isSaturday || isSunny; prn("Is it a sunny or saturday? " + isSunnyOrSaturday);
let isJune, isSunny, isMostlySunny, isNiceJuneDay; isJune = true; isSunny = false; isMostlySunny = true; /*Let us say that we define a nice day in June as: sunny or mostly sunny*/ isNiceJuneDay = isJune && (isSunny || isMostlySunny); prn("Is it a nice day in June? " + isNiceJuneDay);