• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Logical Operators

Like the comparison operators we just took a look at, you use logical operators when creating test conditions that evaluate to a value of true or false. Using logical operators, you can create more powerful test conditions than just using comparison operators alone.

Suppose, for example, that you want to make sure the value in a variable named temperature is between 65 and 75. You can use the greater-than comparison operator, >, to make sure temperature is greater than 65, and the less-than comparison operator, <, to make sure that temperature is less than 75. But how can you make sure both conditions are true in the same if statement?


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint