Want to go over a very important concept in programming called boolean logic using Poulan logic to create
our conditions which in turn will make our decisions we said before that conditions can either evaluate
to TRUE or FALSE.
So your own two values a boolean Bayrou variable can have is what and logic really boils down to getting
things to evaluate to TRUE or FALSE.
There are three main operations we'll go through and or and inverse.
So for and logical and here say we have to in variables A and B.
So the whole condition evaluates to true only if A and B are both true.
So otherwise the combination is false.
So this makes sense if you really think about it both have to be true in order for the entire thing
to be true.
So the next is Wanjiku or so again we say we have our boolean values a and b.
So a or b is true if either is true.
So either A is true or B is true or both a and b are true.
So the only time a or b is false is if A is false and B is false.
So the exact opposite of and
so inverse.
Let's say we have a is a in value and you sign it to be true.
So the inverse of A then is false and vice versa.
Say we add a is false the inverse a would be true it's just the opposite of what the value is.
So there are a few laws that you can use and think about.
And the first one is the associate of law also a or b is the same as B or A.
And of course the same for and is a and b is the same as B and C you can write them in any order.
It's really what this is saying.
The distributive law so let's say we have a and in parentheses B or C is the same as saying a and b
or a and c so it distributes to each part of the expression
so and laso see me have a.
And false.
Well we said before both have to be true for the entire expression to be true so a and false is always
false.
So a and true.
Well that really depends on what a is if a is true then the whole expression of it be true.
But if a was false false and true is false A and A is again really just dependent on what A is and similarly
A and B inverse of A is always false because a can't have the value.
So if A has a value true and inverse of true is false.
So a true and false is false.
So it can't be both true.
So the or law say we have a.
Or false.
Well again it depends on what A is.
So if A was true then the entire expression true if A was false then the entire expression would be
false.
And similarly with the A or true.
Well you said before that if either part of the expression is true then offering it together is always
true.
And then a or a is again always a depends and then a.
Or should say the inverse of A is always true.
So it's the opposite of what the analysts said because say was false A or the inverse of false is true.
So for
and lastly the in version on.
Let's say we have the inverse of the inverse of a well the inverse is just kind of cancel out.
And then you're left with Hey.
There there are some other ways something can evaluate to TRUE and FALSE and we'll see that in the next
lecture.
We also see some examples of what I just outlined in the next lecture and what the syntax we need to
make this to make this work.