Ch 5 boolean logic
Upcoming SlideShare
Loading in...5
×
 

Ch 5 boolean logic

on

  • 2,500 views

 

Statistics

Views

Total Views
2,500
Views on SlideShare
2,500
Embed Views
0

Actions

Likes
0
Downloads
20
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • The Redo button will reverse the last use of the Undo button, restoring the previous action. The Ctrl-Y keyboard shortcut also can be used in place of the Redo button.
  • The Redo button will reverse the last use of the Undo button, restoring the previous action. The Ctrl-Y keyboard shortcut also can be used in place of the Redo button.
  • The Redo button will reverse the last use of the Undo button, restoring the previous action. The Ctrl-Y keyboard shortcut also can be used in place of the Redo button.
  • The Redo button will reverse the last use of the Undo button, restoring the previous action. The Ctrl-Y keyboard shortcut also can be used in place of the Redo button.
  • The Redo button will reverse the last use of the Undo button, restoring the previous action. The Ctrl-Y keyboard shortcut also can be used in place of the Redo button.
  • The Redo button will reverse the last use of the Undo button, restoring the previous action. The Ctrl-Y keyboard shortcut also can be used in place of the Redo button.
  • The Redo button will reverse the last use of the Undo button, restoring the previous action. The Ctrl-Y keyboard shortcut also can be used in place of the Redo button.

Ch 5 boolean logic Ch 5 boolean logic Presentation Transcript

  • Boolean Logic
  • George Boole
    • In1854, George Boole published “ An investigation into the Laws of Thought, on which are founded the Mathematical Theories of Logic and Probabilities.”
    • Boole outlined a system of logic and a corresponding algebraic language dealing with true and false values.
    100 th Anniversary Edition
  • Boolean Logic
    • Boolean logic is a form of mathematics in which the only values used are true and false.
    • Boolean logic is the basis of all modern computing.
    • There are three basic operations in Boolean logic – AND, OR, and NOT.
    100 th Anniversary Edition
  • The AND Operation
    • The AND operation is a binary operation, meaning that it needs two operands.
    • c = a AND b
    • Both a and b must be true for the result to be true.
    F F F F T T a F T b AND
  • The OR Operation
    • The OR operation is also a binary operation with two operands.
    • c = a OR b
    • If either a OR b is true, then the result is true.
    F T F T T T a F T b OR
  • The NOT Operation
    • The NOT operation is a unary operation with only one operand.
    • c = NOT (a)
    • It simply reverses the true or false value of the operand.
    T F F T a NOT
  • Logical Conditions
    • Logical comparisons that are either true or false are most often used as the basis for the true and false values in Boolean logic.
    • They are often used for simple conditions in branching and looping instructions.
    If (hours > 40) pay overtime If (age < 12) stay in the back seat While (count  10) print count increment count
  • Logical Comparison Operators
    • Six different comparison operators are used in mathematics and computer programming.
    A  B A  B A > B A < B A  B A = B In Math A >= B A is greater than or equal to B A <= B A is less than or equal to B A > B A is greater than B A < B A is less than B A<> B or A != B A is not equal to B A = B or A == B A equals B In Programming Condition
  • Compound Conditions
    • Compound Boolean conditions can be created using the Boolean AND, OR and NOT operations in branching and looping instructions.
    If ( (hours > 40) AND (type = hourly) ) pay overtime If ( (age < 12) OR (height < 42 in.) ) stay in the back seat While ( (count <= 10) AND NOT (status = away) ) print name.count increment count
  • Boolean Logic in Alice
  • Boolean Functions Functions in Alice that return true or false values are called Boolean functions. Alice has many such built-in functions, such as these two groups of basic Boolean logic functions and comparison functions.
  • They can be found on the world’s functions tab
  • They are used inside branching and looping instruction tiles
  • Boolean Functions The Boolean comparison functions can be used to create simple true or false conditions.
  • Boolean Functions The Boolean logic functions can be used to create compound conditions.
  • Boolean Functions Alice has many other world-level and object-level fuctions that return true or false values, such as the Boolean proximity functions shown here on aliceLiddel’s functions tab in the details area.
  • Boolean Functions They can be used anywhere that a Boolean value is needed, such as in this If/Else command.