Boolean Logic Logical Operators Comparison Operators Truth tables

  • Published on
    05-Jan-2016

  • View
    215

  • Download
    0

Embed Size (px)

Transcript

  • Boolean LogicLogical OperatorsComparison OperatorsTruth tables

  • Boolean LogicThe Boolean values (named after mathematician George Boole) are TRUE and FALSE.They can be established in a number of ways:AssertionBoolean ExpressionComparison

  • AssertionTo assert means to state.

    VB example:Dim Flag As BooleanFlag = True

  • Boolean ExpressionLogical operators can be used to construct Boolean expressions from Boolean values.The operands (arguments) must be Boolean.

    Notunary, prefixAnddyadic, infixOrdyadic, infixXor dyadic, infix

  • NOTDim Flag As Boolean Flag = TrueFlag = Not Flag

  • AND

    Dim IsNiceWeather As BooleanDim HaveMoney As BooleanDim GoSkiing As BooleanGoSkiing = IsNiceWeather And HaveMoney

  • OR

    Dim GoodBand As BooleanDim HotDate As BooleanDim GoOut As BooleanGoOut = GoodBand Or HotDate

  • XOR

    Dim Cookie As BooleanDim Candy As BooleanDim MomSays As BooleanMomSays = Cookie Xor Candy

  • Comparison (= = >
  • Comparison (= = >
  • Arithmetic Operators(review)exponentiationmultiplicationdivision (real)division (integer quotient)division (integer remainder) additionSubtraction^*/\Mod+-

  • Other Operators (in order of precedence)

Recommended

View more >