Mixed messages about how booleans are evaluated

Hi I just finished the first booleans section and as I understand it the ‘||’ evaluates the left hand side of the comparison to determine if the value is true if so it gives the value of the left side if not then the value of the right. And the “&&” operator does the reverse, evaluate the comparison left to right and if the left side is false it gives the value on the right side of the comparison. But in Ivan’s video he is saying both sides of the comparison need to be true to return a true value when in the book it’s only evaluating the left side and then providing a value return of either the left or right. To me it seems the logic behind how the answer is found is different. Based on the book when I look at a comparison I am trying to determine if the left side is true or false and the depending on operator giving the value of the left or right side (if its the ‘or’ operator and the value is true I am giving the value of the left side of the comparison and if its false the value of the right side. And if its the ‘&&’ operator I am giving the value of the left side of the comparison when the value is false and the value of the right side when the value if true.)

1 Like

Hey @SustainableProfits, hope you are well.

The boolean operators logic comes from the same algebraic logic for math, you can research more on them over youtube, but the basics on computers are the same than math.

https://library.columbia.edu/find/clio/classic-help/boolean_operators.html

Carlos Z

2 Likes