Logical Operators

As you begin to use the three logical operators (and, or, and not), you will change the way you think and the way you talk—at least, I did. For me, the word and put off its role as an absentminded connector of thoughts because and has a very specific meaning. For example, let’s say that you are standing in the rain waiting for a bus, and let’s say you are standing in front of a little store. The owner of the stores comes to the door and says to you, “You’re welcome to wait inside if you are cold and wet.” (Warning: You are about to begin to understand why programmers have a stereotype of being rude and antisocial.) What the store owner probably meant to say is, “You’re welcome to wait inside if you are wet or cold.” Certainly, ...

Get Learning to Program now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.