munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.79k stars 1.03k forks source link

Typo in section 3.4.3? #883

Closed t1nfoil closed 3 years ago

t1nfoil commented 3 years ago

In http://craftinginterpreters.com/the-lox-language.html) section 3.4.3

The other two logical operators really are control flow constructs in the guise of expressions.
An and expression determines if two values are both true. It returns the left operand if it’s false, 
or the right operand otherwise:

true and false; // false.
true and true;  // true.

-- The part that says it returns the left operand if it is false, or the right operand otherwise. In the example true and false it's returning false (as it should) but true is the left operand no the right one? It should be false and true; // false?

Also email contact info at the bottom of page -- bob@craftinginterpreters.com seems to bounce back with this error from O365 --

bob wasn't found at craftinginterpreters.com, or the mailbox is unavailable.

cm1776 commented 3 years ago

Hello @80at8,

The sentence you refer to It returns the left operand if it’s false, or the right operand otherwise: means the following:

The andexpression returns the left operand if the left operand evaluates to false; otherwise (i.e. if the left operand evaluates to true), the expression returns the right operand.

So the examples Bob gave are correct.

Cheers

munificent commented 3 years ago

As @cm1776 says, the examples there are correct. I could also show the example you have too, but doing the whole truth table felt like overkill to me.

Also email contact info at the bottom of page -- bob@craftinginterpreters.com seems to bounce back with this error from O365 --

bob wasn't found at craftinginterpreters.com, or the mailbox is unavailable.

Oops! My email was in a weird state. It should be in a better place now.