[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:02.92,0:00:05.57,Default,,0000,0000,0000,,In the English language,\Nwe have different parts of speech, Dialogue: 0,0:00:05.57,0:00:08.31,Default,,0000,0000,0000,,like noun, adjective, preposition, verb. Dialogue: 0,0:00:08.31,0:00:09.89,Default,,0000,0000,0000,,And then there are a bunch of rules Dialogue: 0,0:00:09.89,0:00:12.60,Default,,0000,0000,0000,,that tell us how to put\Nthese different parts of speech together. Dialogue: 0,0:00:12.60,0:00:19.34,Default,,0000,0000,0000,,So if I said something like,\N"Dog books my eats," Dialogue: 0,0:00:19.34,0:00:22.03,Default,,0000,0000,0000,,you'd be like,\N"What the heck does that mean?" Dialogue: 0,0:00:22.03,0:00:23.91,Default,,0000,0000,0000,,And if you didn't realize this before, Dialogue: 0,0:00:23.91,0:00:25.87,Default,,0000,0000,0000,,apparently, you can't just stick\Ntwo nouns Dialogue: 0,0:00:25.87,0:00:28.11,Default,,0000,0000,0000,,in front of an adjective,\Nin front of a verb. Dialogue: 0,0:00:28.11,0:00:29.44,Default,,0000,0000,0000,,Doesn't work. Dialogue: 0,0:00:29.44,0:00:34.76,Default,,0000,0000,0000,,But if I'd switched those and said,\N"My dog eats books," Dialogue: 0,0:00:34.76,0:00:37.26,Default,,0000,0000,0000,,then you would totally know what I meant. Dialogue: 0,0:00:37.26,0:00:38.91,Default,,0000,0000,0000,,I could even replace this verb "eats" Dialogue: 0,0:00:38.91,0:00:42.76,Default,,0000,0000,0000,,with another verb like,\NI don't know, "throws", Dialogue: 0,0:00:42.76,0:00:45.43,Default,,0000,0000,0000,,and it would still make grammatical sense, Dialogue: 0,0:00:45.43,0:00:47.88,Default,,0000,0000,0000,,even if you can't imagine\Nmy dog throwing a book. Dialogue: 0,0:00:47.88,0:00:49.99,Default,,0000,0000,0000,,So in programming,\Ninstead of parts of speech, Dialogue: 0,0:00:49.99,0:00:52.12,Default,,0000,0000,0000,,we have these things called types. Dialogue: 0,0:00:52.12,0:00:54.48,Default,,0000,0000,0000,,You've already seen one of these: numbers. Dialogue: 0,0:00:54.48,0:00:57.07,Default,,0000,0000,0000,,We use numbers all the time\Nin our drawing code. Dialogue: 0,0:00:57.07,0:00:58.54,Default,,0000,0000,0000,,And just like in English, Dialogue: 0,0:00:58.54,0:01:01.80,Default,,0000,0000,0000,,there are times it makes sense to use\Na number, and times when it doesn't. Dialogue: 0,0:01:01.80,0:01:06.10,Default,,0000,0000,0000,,If I started typing in\Nthis background function, "100 minus", Dialogue: 0,0:01:06.10,0:01:08.70,Default,,0000,0000,0000,,then whatever comes next\Nbetter be a number, Dialogue: 0,0:01:08.70,0:01:13.51,Default,,0000,0000,0000,,or at least something that evaluates\Nto a number like "14 + 15." Dialogue: 0,0:01:13.51,0:01:17.83,Default,,0000,0000,0000,,On the other hand,\Nif I'd just typed "100 space", Dialogue: 0,0:01:17.83,0:01:20.43,Default,,0000,0000,0000,,well, I can't really put\Na number after that Dialogue: 0,0:01:20.43,0:01:23.82,Default,,0000,0000,0000,,because "100-space-10"\Ndoesn't mean anything. Dialogue: 0,0:01:23.82,0:01:27.53,Default,,0000,0000,0000,,So there's another type in programming,\Ncalled the Boolean type. Dialogue: 0,0:01:27.53,0:01:29.13,Default,,0000,0000,0000,,And it's called Boolean Dialogue: 0,0:01:29.13,0:01:33.63,Default,,0000,0000,0000,,because some dude\Nnamed George Boole invented it. Dialogue: 0,0:01:33.63,0:01:37.39,Default,,0000,0000,0000,,And unlike a number\Nwhich has a ton of possible values, Dialogue: 0,0:01:37.39,0:01:42.03,Default,,0000,0000,0000,,a Boolean can only be\None of two values: true or false. Dialogue: 0,0:01:43.00,0:01:44.93,Default,,0000,0000,0000,,And you can see\Nwhen I type them they turn blue, Dialogue: 0,0:01:44.93,0:01:47.33,Default,,0000,0000,0000,,which means they're\Nsuper special awesome words. Dialogue: 0,0:01:47.33,0:01:49.43,Default,,0000,0000,0000,,And you've already seen one place\Nwhere we use booleans, Dialogue: 0,0:01:49.43,0:01:52.04,Default,,0000,0000,0000,,though you may not have realized it:\Nif statements! Dialogue: 0,0:01:52.04,0:01:53.97,Default,,0000,0000,0000,,Let's get a quick refresh\Non how those work. Dialogue: 0,0:01:53.97,0:01:58.93,Default,,0000,0000,0000,,I'm just going to make a variable\Ncalled 'number, ' give it a number, 40. Dialogue: 0,0:01:58.93,0:02:01.50,Default,,0000,0000,0000,,And write an If statement that says, Dialogue: 0,0:02:01.50,0:02:08.71,Default,,0000,0000,0000,,"If number is less than 50,\Nthen I will draw this first ellipse." Dialogue: 0,0:02:10.80,0:02:13.04,Default,,0000,0000,0000,,I'm just going to copy this\Ninto the If statement Dialogue: 0,0:02:13.04,0:02:16.23,Default,,0000,0000,0000,,and indent it by selecting everything\Nand pressing tab. Dialogue: 0,0:02:16.23,0:02:18.33,Default,,0000,0000,0000,,So now this statement says, Dialogue: 0,0:02:18.33,0:02:22.77,Default,,0000,0000,0000,,"If number is less than 50," which it is,\N"then we'll draw the top ellipse." Dialogue: 0,0:02:22.77,0:02:25.43,Default,,0000,0000,0000,,And if I make number greater than 50, Dialogue: 0,0:02:25.43,0:02:28.43,Default,,0000,0000,0000,,you can see\Nthat the top ellipse disappears. Dialogue: 0,0:02:28.43,0:02:30.57,Default,,0000,0000,0000,,Alright, so this thing\Ninside the parentheses Dialogue: 0,0:02:30.57,0:02:32.83,Default,,0000,0000,0000,,is actually a Boolean expression. Dialogue: 0,0:02:32.83,0:02:36.16,Default,,0000,0000,0000,,Remember, a math expression\Nis anything that evaluates to a number: Dialogue: 0,0:02:36.16,0:02:40.20,Default,,0000,0000,0000,,like 3 plus 2 plus 4 times 8. Dialogue: 0,0:02:40.20,0:02:43.80,Default,,0000,0000,0000,,So a Boolean expression is anything\Nthat evaluates to a Boolean. Dialogue: 0,0:02:43.80,0:02:46.50,Default,,0000,0000,0000,,A good way to check\Nif an expression evaluates to a Boolean, Dialogue: 0,0:02:46.50,0:02:50.50,Default,,0000,0000,0000,,is to stick the word "is" in front of it,\Nand ask it like a question. Dialogue: 0,0:02:50.50,0:02:54.04,Default,,0000,0000,0000,,If it sounds like a yes or no question,\Nthen you know it's a Boolean expression. Dialogue: 0,0:02:54.04,0:02:57.14,Default,,0000,0000,0000,,So here we can say,\N"Is number less than 50?" Dialogue: 0,0:02:57.14,0:03:00.60,Default,,0000,0000,0000,,Yes, yes it is, and yes,\Nthat is a Boolean expression. Dialogue: 0,0:03:00.60,0:03:04.17,Default,,0000,0000,0000,,On the other hand,\Nif I had something like, "4 + 4" Dialogue: 0,0:03:04.17,0:03:10.22,Default,,0000,0000,0000,,and I tried to ask, "is 4 + 4?"\NNo. not a Boolean. Dialogue: 0,0:03:10.22,0:03:12.06,Default,,0000,0000,0000,,So back to our If statement. Dialogue: 0,0:03:12.06,0:03:14.57,Default,,0000,0000,0000,,I can actually put anything\Ninside these parentheses, Dialogue: 0,0:03:14.57,0:03:17.46,Default,,0000,0000,0000,,as long as it's a Boolean\Nor Boolean expression. Dialogue: 0,0:03:17.46,0:03:21.29,Default,,0000,0000,0000,,So I could say, "If true,"\Nand that ellipse would always be drawn. Dialogue: 0,0:03:21.29,0:03:24.60,Default,,0000,0000,0000,,Or I could say, "If false,"\Nand the ellipse would never be drawn. Dialogue: 0,0:03:24.60,0:03:28.70,Default,,0000,0000,0000,,I could also do something like\N"If 3 is less than 4," Dialogue: 0,0:03:28.70,0:03:32.04,Default,,0000,0000,0000,,which is a Boolean expression\Nthat will always evaluate to true, Dialogue: 0,0:03:32.04,0:03:34.66,Default,,0000,0000,0000,,which is kinda pointless,\Nthe ellipse will always be drawn, Dialogue: 0,0:03:34.66,0:03:38.04,Default,,0000,0000,0000,,or "3 greater than 4,"\Nand that's always going to be false. Dialogue: 0,0:03:38.04,0:03:41.05,Default,,0000,0000,0000,,And I can also assign Booleans\Nto variables, like this: Dialogue: 0,0:03:41.05,0:03:48.77,Default,,0000,0000,0000,,so I'm going to make a new variable,\Ncall it WinstonIsCool, and assign it Dialogue: 0,0:03:48.77,0:03:51.50,Default,,0000,0000,0000,,a Boolean value, so true or false. Dialogue: 0,0:03:51.50,0:03:54.27,Default,,0000,0000,0000,,Say true because Winston\Nis definitely cool. Dialogue: 0,0:03:54.27,0:03:57.05,Default,,0000,0000,0000,,And now that this variable\Nhas a Boolean value, Dialogue: 0,0:03:57.05,0:04:00.44,Default,,0000,0000,0000,,I can copy it and stick it\Ninside this If statement Dialogue: 0,0:04:00.44,0:04:04.12,Default,,0000,0000,0000,,and now you can see the ellipse is drawn, Dialogue: 0,0:04:04.12,0:04:06.73,Default,,0000,0000,0000,,because the value\Nof WinstonIsCool is true. Dialogue: 0,0:04:06.73,0:04:10.60,Default,,0000,0000,0000,,I could also replace this\Nwith a Boolean expression, Dialogue: 0,0:04:10.60,0:04:14.20,Default,,0000,0000,0000,,so could be "2 less than 4." Dialogue: 0,0:04:14.20,0:04:18.10,Default,,0000,0000,0000,,Now if you're making a variable\Nthat's meant for a Boolean value, Dialogue: 0,0:04:18.10,0:04:19.60,Default,,0000,0000,0000,,you should give it a name Dialogue: 0,0:04:19.60,0:04:21.100,Default,,0000,0000,0000,,that describes the condition\Nwhen the variable is true. Dialogue: 0,0:04:21.100,0:04:24.90,Default,,0000,0000,0000,,A good way to check if you've picked\Na good name for your variable Dialogue: 0,0:04:24.90,0:04:28.33,Default,,0000,0000,0000,,is to put it in an If statement\Nand see if it makes sense as a condition. Dialogue: 0,0:04:28.33,0:04:31.43,Default,,0000,0000,0000,,So, forget WinstonIsCool,\Nwe already know that's true. Dialogue: 0,0:04:31.43,0:04:34.31,Default,,0000,0000,0000,,Let's say I had a variable\Ncalled "muffins." Dialogue: 0,0:04:34.31,0:04:37.10,Default,,0000,0000,0000,,All right, "If muffins." Hmm. Dialogue: 0,0:04:37.10,0:04:38.30,Default,,0000,0000,0000,,Well, you know what? Dialogue: 0,0:04:38.30,0:04:42.17,Default,,0000,0000,0000,,That doesn't tell me anything,\Nso that's a pretty bad variable name, Dialogue: 0,0:04:42.17,0:04:46.17,Default,,0000,0000,0000,,but if I had "If muffinsAreBaking",\Nthen that would tell me Dialogue: 0,0:04:46.17,0:04:50.93,Default,,0000,0000,0000,,that when this variable is true,\Nthen the muffins are baking. Dialogue: 0,0:04:50.93,0:04:54.23,Default,,0000,0000,0000,,And don't ask me what muffins,\Nit's not important. Dialogue: 0,0:04:54.23,0:04:59.00,Default,,0000,0000,0000,,So for now let's go back\Nto "If number is less than 50." Dialogue: 0,0:04:59.00,0:05:00.38,Default,,0000,0000,0000,,Cool. Dialogue: 0,0:05:00.38,0:05:02.54,Default,,0000,0000,0000,,Now let's look\Nat some other Boolean expressions. Dialogue: 0,0:05:02.54,0:05:05.77,Default,,0000,0000,0000,,You've already seen\N"less than" and "greater than", Dialogue: 0,0:05:05.77,0:05:09.08,Default,,0000,0000,0000,,but you can also check\Nif something is "less than or equal to." Dialogue: 0,0:05:09.08,0:05:12.57,Default,,0000,0000,0000,,So let's try, "If number is\Nless than or equal to 48." Dialogue: 0,0:05:12.57,0:05:20.03,Default,,0000,0000,0000,,And we could also say, "If number\Nis greater than or equal to 48." Dialogue: 0,0:05:20.03,0:05:24.20,Default,,0000,0000,0000,,If it is, we will draw\Nthis top-right ellipse. Dialogue: 0,0:05:24.20,0:05:27.38,Default,,0000,0000,0000,,Indent that. Dialogue: 0,0:05:27.38,0:05:30.27,Default,,0000,0000,0000,,And if you'd like to check if two things\Nare exactly equal to each other Dialogue: 0,0:05:30.27,0:05:32.42,Default,,0000,0000,0000,,or you could say: "If number" Dialogue: 0,0:05:32.42,0:05:36.28,Default,,0000,0000,0000,,and then three equals signs,\Nor "triple equals 48." Dialogue: 0,0:05:39.49,0:05:42.50,Default,,0000,0000,0000,,So that's a lot more like the equals sign\Nyou're used to in math, Dialogue: 0,0:05:42.50,0:05:44.79,Default,,0000,0000,0000,,except this time\Nyou have three of them in a row. Dialogue: 0,0:05:44.79,0:05:46.63,Default,,0000,0000,0000,,It's kind of overkill, right? Dialogue: 0,0:05:46.63,0:05:48.90,Default,,0000,0000,0000,,And then finally, we have\Nif you want to check Dialogue: 0,0:05:48.90,0:05:51.24,Default,,0000,0000,0000,,if two things are not equal to, Dialogue: 0,0:05:51.24,0:05:53.24,Default,,0000,0000,0000,,so strictly not equal to, you can say, Dialogue: 0,0:05:53.24,0:05:57.60,Default,,0000,0000,0000,,"If number" and then an exclamation point,\Nand then 2 equals signs, "48". Dialogue: 0,0:05:57.60,0:06:02.13,Default,,0000,0000,0000,,And then we will draw that last ellipse. Dialogue: 0,0:06:04.10,0:06:07.50,Default,,0000,0000,0000,,So if we go back to the top,\Nwe can see that number is 48, Dialogue: 0,0:06:07.50,0:06:09.76,Default,,0000,0000,0000,,so it is less than or equal to 48, Dialogue: 0,0:06:09.76,0:06:11.77,Default,,0000,0000,0000,,which is why\Nthe top-left ellipse is drawn. Dialogue: 0,0:06:11.77,0:06:16.20,Default,,0000,0000,0000,,It's also greater than or equal to 48,\Nit's also equal to 48, Dialogue: 0,0:06:16.20,0:06:18.70,Default,,0000,0000,0000,,but it is not not equal to 48, Dialogue: 0,0:06:18.70,0:06:21.63,Default,,0000,0000,0000,,which is why we're missing\Nthat bottom-right ellipse. Dialogue: 0,0:06:21.63,0:06:23.80,Default,,0000,0000,0000,,And if we play around with number Dialogue: 0,0:06:23.80,0:06:26.35,Default,,0000,0000,0000,,you can see it changes\Nwhich ellipses are drawn. Dialogue: 0,0:06:26.100,0:06:29.63,Default,,0000,0000,0000,,So now you guys know about Booleans. Dialogue: 0,0:06:29.63,0:06:31.30,Default,,0000,0000,0000,,And just like math expressions, Dialogue: 0,0:06:31.30,0:06:33.73,Default,,0000,0000,0000,,Boolean expressions\Ncan get really complicated. Dialogue: 0,0:06:33.73,0:06:35.74,Default,,0000,0000,0000,,But we will talk about those another time.