1
00:00:05,970 --> 00:00:07,565
Hi, welcome to this new video.

2
00:00:07,565 --> 00:00:09,731
We are going to be introducing week three,

3
00:00:09,731 --> 00:00:13,090
where we're going to start
looking into Boolean logic.

4
00:00:13,090 --> 00:00:17,796
So let's try to understand this idea of
Boolean logic that it's at the center of

5
00:00:17,796 --> 00:00:19,812
computing in many ways, right?

6
00:00:19,812 --> 00:00:24,010
Boolean logic is an expression
that after we evaluate,

7
00:00:24,010 --> 00:00:27,812
it will return a true or
false statement, right?

8
00:00:27,812 --> 00:00:33,548
Boolean meaning, there's only two options,
there's no in between, right?

9
00:00:33,548 --> 00:00:35,788
So it's a zero and a one, right?

10
00:00:35,788 --> 00:00:37,350
A true or a false, right?

11
00:00:39,050 --> 00:00:45,840
So what kind of expressions can we use
to evaluate this condition, right?

12
00:00:45,840 --> 00:00:51,247
So we have many specific operators
within our programming environment,

13
00:00:51,247 --> 00:00:55,860
our syntax, that check for
this Boolean condition, right?

14
00:00:55,860 --> 00:00:58,921
So we have operators like equal to, right,

15
00:00:58,921 --> 00:01:03,508
which is used with this double
equal sign or bigger than, right?

16
00:01:03,508 --> 00:01:07,384
So if you have a number five,
is it bigger than number six?

17
00:01:07,384 --> 00:01:09,256
The answer would be false, right?

18
00:01:09,256 --> 00:01:14,275
But you have several others, right,
like greater than, less than or

19
00:01:14,275 --> 00:01:18,936
equal to, greater than or
equal to, and not equal to, right?

20
00:01:18,936 --> 00:01:23,050
So we're going to be looking
at those specifically in code.

21
00:01:23,050 --> 00:01:26,398
Let's just look at an example of
how we could actually use these

22
00:01:26,398 --> 00:01:27,740
expressions, right?

23
00:01:27,740 --> 00:01:30,970
So let's imagine we have two variables,
a and b.

24
00:01:30,970 --> 00:01:34,336
In this case, a is 5, b is 10.

25
00:01:34,336 --> 00:01:38,512
And if we would like to print
the result of a bigger than b,

26
00:01:38,512 --> 00:01:43,360
you have to think of this expression
as a question mark, right?

27
00:01:43,360 --> 00:01:45,265
Is a bigger than b?

28
00:01:45,265 --> 00:01:45,968
Right?

29
00:01:45,968 --> 00:01:47,860
And in this case, that is not true.

30
00:01:47,860 --> 00:01:48,932
It's false, right?

31
00:01:48,932 --> 00:01:52,330
So the result of that
expression would be false.

32
00:01:52,330 --> 00:01:56,628
If we had the symbol in the other
direction, it would be true, right?

33
00:01:56,628 --> 00:01:59,614
If we would ask the question,
are those equal?

34
00:01:59,614 --> 00:02:03,838
Because the double equal sign would
ask the question, is it equal?

35
00:02:03,838 --> 00:02:09,912
We would also get a false because those
two items are not the same value, right?

36
00:02:09,912 --> 00:02:13,287
So let's look at the different
expressions that we have and

37
00:02:13,287 --> 00:02:17,202
see how we would actually write
them in our programming language.

38
00:02:17,202 --> 00:02:21,070
So here we are in processing once more.

39
00:02:21,070 --> 00:02:22,680
Let's just repeat that example, but

40
00:02:22,680 --> 00:02:25,328
we're going to play with a few
different expressions, right?

41
00:02:25,328 --> 00:02:32,128
So a = 5, b = 10, right?

42
00:02:32,128 --> 00:02:36,282
So let's evaluate our print

43
00:02:36,282 --> 00:02:42,370
expression a is bigger than b, right?

44
00:02:42,370 --> 00:02:45,878
Just to make sure we have,
it's very visible there and

45
00:02:45,878 --> 00:02:48,996
we're just going to print
it in the console here.

46
00:02:48,996 --> 00:02:52,470
As you can see, that is in fact false.

47
00:02:52,470 --> 00:02:55,998
If the screen is getting in the way,
we can do this a lot smaller.

48
00:02:55,998 --> 00:02:58,564
I mean,
we don't really need a screen right now,

49
00:02:58,564 --> 00:03:02,172
we really trying to understand these
Boolean expressions first, and

50
00:03:02,172 --> 00:03:06,730
then we're going to start digging into
how we can use them in design, right?

51
00:03:06,730 --> 00:03:08,400
So as I was mentioning,

52
00:03:08,400 --> 00:03:13,420
you could actually use this symbol
in the opposite direction, right?

53
00:03:14,830 --> 00:03:17,872
And you would see that it's true, right?

54
00:03:17,872 --> 00:03:21,680
Let's use the equal or double equal sign.

55
00:03:21,680 --> 00:03:23,152
That is a question mark.

56
00:03:23,152 --> 00:03:25,463
I get this question a lot, which is,

57
00:03:25,463 --> 00:03:29,057
what is the difference between
one symbol of equal sign?

58
00:03:29,057 --> 00:03:32,596
Right?
This and this, right?

59
00:03:32,596 --> 00:03:36,530
So if you think about it,
when you're using one equal sign,

60
00:03:36,530 --> 00:03:40,024
you're assigning,
you're saying a = b, right?

61
00:03:40,024 --> 00:03:41,976
In this case, this wouldn't really work.

62
00:03:41,976 --> 00:03:45,243
You are assigning some
attributes to a variable.

63
00:03:45,243 --> 00:03:48,072
But a double equal, it's a question mark.

64
00:03:48,072 --> 00:03:51,015
You have to think of all these kind
of Boolean expressions as question

65
00:03:51,015 --> 00:03:51,932
marks, right?

66
00:03:51,932 --> 00:03:54,687
Is a equal to b?

67
00:03:54,687 --> 00:03:56,410
Right?

68
00:03:56,410 --> 00:03:59,996
And the result will naturally
become true or false, right?

69
00:03:59,996 --> 00:04:06,670
In this case, if we try,
it would be false.

70
00:04:06,670 --> 00:04:11,278
The version of this statement
which is not equal, right,

71
00:04:11,278 --> 00:04:15,323
which basically we are checking for
equality, but

72
00:04:15,323 --> 00:04:20,770
at the same time we're actually saying,
is it not equal?

73
00:04:20,770 --> 00:04:25,710
And that would be true, right,
because those two values are not equal.

74
00:04:26,950 --> 00:04:28,520
Let's do one more.

75
00:04:28,520 --> 00:04:33,789
Let's imagine that the actual
ones that are quite

76
00:04:33,789 --> 00:04:38,760
interesting is like bigger or
equal, right?

77
00:04:38,760 --> 00:04:42,976
This is kind of, you will realize
that you use these expressions,

78
00:04:42,976 --> 00:04:46,292
you'll start using these
expressions quite a bit,

79
00:04:46,292 --> 00:04:51,110
especially when you have a domain,
let's say that goes from zero to 10 and

80
00:04:51,110 --> 00:04:55,552
you want to make inclusive the last value,
let's say 10, right?

81
00:04:55,552 --> 00:04:59,832
So maybe you have a value of 9 and
that would be,

82
00:04:59,832 --> 00:05:05,332
let's just do it smaller than
to make this example, right?

83
00:05:05,332 --> 00:05:11,620
So we have this case where the value
of a is smaller than 9, that's correct.

84
00:05:11,620 --> 00:05:17,590
But eventually, maybe we have
an iterator and eventually a reaches 10.

85
00:05:17,590 --> 00:05:22,626
If we would have the value
just bigger than, right,

86
00:05:22,626 --> 00:05:28,152
as we have here,
we would actually get a false, right?

87
00:05:28,152 --> 00:05:31,816
But sometimes you do want to include,

88
00:05:31,816 --> 00:05:36,466
that it includes this
final value on equality.

89
00:05:36,466 --> 00:05:41,302
So bigger and equal than might
become handy in those cases, or

90
00:05:41,302 --> 00:05:43,420
smaller than equal than.

91
00:05:43,420 --> 00:05:47,154
So there's a series of Boolean
expressions that are very, very useful.

92
00:05:47,154 --> 00:05:52,626
We're going to start learning how to use
these Boolean expressions in conditionals.

93
00:05:52,626 --> 00:05:54,800
So we'll look at that in the next video.