Difference between revisions of "CSC103: DT's Notes 1"

From dftwiki3
Jump to: navigation, search
Line 79: Line 79:
  
 
The table above is the ''truth table'' for the '''and''' logical operator.  It says that if the statement '''a''' is true, and if '''b''' is false, then the '''and''' operator makes the result of ''a'' '''and''' ''b''  false.  Only if both statements are true will the result of '''and'''-ing them together be true.  This is still pretty abstract.  Let's see if we can make this clearer.  Assume that ''a'' is the statement ''Today is Monday'', and that ''b'' is the statement ''The time is 9:00 a.m.'', and that you want to be reminded every Monday at 9:00 a.m. to go to Ford Hall to take a particular class.  So we can define the alarm signal that reminds you to be ''a'' '''and''' ''b''.  The alarm will ring only when the day is Monday, and the time is 9:00 a.m.  At 9:00 a.m. on Tuesdays nothing will happen, because at that particular time ''a'' is false, and ''b'' is true, but the '''and''' operator is extremely strick and will not generate true if only one of its operands is true.
 
The table above is the ''truth table'' for the '''and''' logical operator.  It says that if the statement '''a''' is true, and if '''b''' is false, then the '''and''' operator makes the result of ''a'' '''and''' ''b''  false.  Only if both statements are true will the result of '''and'''-ing them together be true.  This is still pretty abstract.  Let's see if we can make this clearer.  Assume that ''a'' is the statement ''Today is Monday'', and that ''b'' is the statement ''The time is 9:00 a.m.'', and that you want to be reminded every Monday at 9:00 a.m. to go to Ford Hall to take a particular class.  So we can define the alarm signal that reminds you to be ''a'' '''and''' ''b''.  The alarm will ring only when the day is Monday, and the time is 9:00 a.m.  At 9:00 a.m. on Tuesdays nothing will happen, because at that particular time ''a'' is false, and ''b'' is true, but the '''and''' operator is extremely strick and will not generate true if only one of its operands is true.
 +
 +
The truth table for the '''or''' operator is the following:
 +
 +
{| border="1" cellpadding="10" cellspacing="0"
 +
! a
 +
! b
 +
! a '''or''' b
 +
|-
 +
|
 +
F
 +
|
 +
F
 +
|
 +
F
 +
|-
 +
|
 +
F
 +
|
 +
T
 +
|
 +
T
 +
|-
 +
|
 +
T
 +
|
 +
F
 +
|
 +
T
 +
|-
 +
|
 +
T
 +
|
 +
T
 +
|
 +
T
 +
|}
 +
  
 
An example will illustrate this concept.
 
An example will illustrate this concept.

Revision as of 16:49, 30 January 2012

--© D. Thiebaut 08:10, 30 January 2012 (EST)


...