Wednesday, May 16, 2018

|| and && Operators


The "||" and "&&" operators, and/or respectively, are generally used for If statements, and either evaluate to the Boolean values True or False. The way it works is simple, the operator is put between two other "==" statements, and for the AND operator, if (1==1&&2==2) the statement will evaluate to true. If only one statement is true, then the whole statement is false. The OR operator works so that if (water == water || 2 == 1), even though 2 is not equal to 1 half of the statement is true so the entire statement is true.

3 comments: