1 / 12

Boolean Logic

Boolean Logic. Logical Operators Comparison Operators Truth tables. Boolean Logic. The Boolean values (named after mathematician George Boole) are TRUE and FALSE . They can be established in a number of ways: Assertion Boolean Expression Comparison. Assertion.

netis
Download Presentation

Boolean Logic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Boolean Logic Logical Operators Comparison Operators Truth tables

  2. Boolean Logic • The Boolean values (named after mathematician George Boole) are TRUE and FALSE. • They can be established in a number of ways: • Assertion • Boolean Expression • Comparison

  3. Assertion To assert means to state. VB example: Dim Flag As Boolean Flag = True

  4. Boolean Expression Logical operators can be used to construct Boolean expressions from Boolean values. The operands (arguments) must be Boolean. Not unary, prefix And dyadic, infix Or dyadic, infix Xor dyadic, infix

  5. NOT Dim Flag As Boolean Flag = True Flag = Not Flag

  6. AND Dim IsNiceWeather As Boolean Dim HaveMoney As Boolean Dim GoSkiing As Boolean GoSkiing = IsNiceWeather And HaveMoney

  7. OR Dim GoodBand As Boolean Dim HotDate As Boolean Dim GoOut As Boolean GoOut = GoodBand Or HotDate

  8. XOR Dim Cookie As Boolean Dim Candy As Boolean Dim MomSays As Boolean MomSays = Cookie Xor Candy

  9. Comparison (= <> <= >= > <) Comparison Operators are used to establish relationships between Boolean values. All operators are dyadic, infix. Their arguments can be of any data type, but must be similar, i.e. both Boolean, both numeric, both String.

  10. Comparison (= <> <= >= > <) Dim X As Double Dim Y As Integer Dim Name1 As String Dim Name2 As String Dim Result As Boolean Result = Name1 < Name2 Result = X = Y

  11. exponentiation multiplication division (real) division (integer quotient) division (integer remainder) addition Subtraction ^ * / \ Mod + - Arithmetic Operators(review)

  12. Other Operators (in order of precedence)

More Related