All right.
So we're moving onto logical order which as I just mentioned is like a brother or sister to a logical
end.
And if you've worked with any programming language you're most likely familiar with and and or logical
and and logical or so logical or you can either write out as Omar or just like we could write A&E for
and or we can use these two pipe symbols.
So these are not uppercase eyes or els or ones they are the piped character which is usually located
above the right return or enter key.
You have to hit shift most often to hit it.
So it's two of them together just like it was two ampersands for and just symbols.
It's pretty standardized or very standardized across all program languages that I've worked in ampersands
and types for or.
But you can also use the phonetic or that spelt that version o r.
So before we dive into exactly how it works let's try something.
So we had this in the last video.
So it's all books written by Dave Eggers.
Released after the year 2010.
But what if we just change the ampersands to the or pipes.
What do you think will happen first of all.
So I'm just going to copy this an Oxford type this all again.
And just change the ampersands here to OR and make a hit return.
So it's clear what's happening.
So if we read this if you just say the word or hear it makes a bit more sense it's like title An author
name and released year from books where author name is Aggers or released here is greater than 2010.
So if we run it what we'll get is all books written by Dave Eggers and all books were released here
is greater than 2010.
So rather than both sides of this having to be true just if either side is true we'll get the data so
we get all the books by Eggers including this one a heartbreaking work a staggering genius which came
before 2010 but then we move on to the second part which is to selected all books that were released
after 2010 regardless of the author's name.
So it's a way for us to specify two things either of which we want to be true or both.
So in the case of a hologram for the king it is both written by Dave Eggers and it was released after
2010 or same thing with the circle here.
But 10 percent happier for instance it was only this part was true released years greater than 2010
because author L name is Harris or Saunders In this case or gaming.
OK so again that symbol right there.
I forgot I made this nice little slide this animation that changes symbol is very very important.
It changes the meaning entirely from the statement.
So if we have two conditions with an ampersand between them or three or any number of conditions with
ampersands it means that both sides must be true in order for the whole thing to be true as we've seen
already.
However with the OR operator it means only one side must be true for the whole thing to be true or both
sides can be true as well.
And I know that's a bit odd to talk about in this way without actual examples.
So if we hop over again and we do the same thing I've been doing the last couple of videos and to type
up a few example exercises and then we'll go over solutions.
OK so I'm back here.
I've got three just three this time that I'll use logical order to try them out and then I'll be back
with a solution and I'm back already.
OK.
So first one here.
40.
Less than or equal to 100.
Well that part's true.
Forty is less than 100.
So it doesn't matter what's over here.
This whole thing is true because we only need one half to be true.
Happens that negative 2 is not greater than zero but that's irrelevant because the left side is true.
Moving on to this one 10 and greater than five is that true.
Yes.
So it doesn't matter what's on the right side.
But that happens to also be true that the whole thing is true.
So we get one and this last one bit of a curve ball is the letter A.
Equal to the number five.
Well that's not true.
However this side says 3000 is greater than 2000.
That is true.
So the whole thing is true
as you can see we get one for true.
OK.
Last thing before I forget.
Just like with.
And we can chain or together as many times we want.
So it doesn't have to be something like this.
So if I go back to this example it's like title author I'll name released your from books where author
name is Aggers or release here is greater than 2010.
So let's try adding an OR here and I'll spell it out this time.
And let's say not only do we care or do we want to select things written by Eggers or released or greater
than 2010.
We'll also add another or which is stock quantity is greater than 100.
So books that we have a lot of stock in as well.
And let's also print stock quantity just like that just copy this whole thing.
Paste it semi-colon.
And if we look to see it makes a slight difference because we also get this.
David Foster Wallace story collection in here which was written in 2004 which normally wouldn't make
the cut with our previous version but because we added star quantity greater than 100.
It's in here because stuck on the is greater than 172.
So for some of these for instance a hologram for the king.
All three parts are true.
It's written by Aggers it's released after 2010 and it has more than 100 copies in stock.
But then like for David Foster Wallace and oblivion only one part is true.
The last part.
So it just goes to show you that only one component even if we have three different conditions only
one part has to be true for the entire thing to be true.
And for it to be selected and spit back to us OK.
So that's logical or one thing that I will point out that I know you're probably dying to get on with
this video but you can combine or and and see how to do that in a little bit.