Download presentation
Presentation is loading. Please wait.
Published byDaniela Delphia Thompson Modified over 9 years ago
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. Notunary, prefix Anddyadic, infix Ordyadic, 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
Arithmetic Operators (review) exponentiation multiplication division ( real ) division ( integer quotient ) division ( integer remainder ) addition Subtraction ^ * / \ Mod + -
12
Other Operators (in order of precedence) Concatenation&, + Comparison= <> = > < LogicalNot And Or Xor Assignment=
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.