1 00:00:00,660 --> 00:00:01,760 Hello and welcome. 2 00:00:01,800 --> 00:00:09,810 In this video I will explain what statements are in computer programming. 3 00:00:09,810 --> 00:00:13,170 What is a statement. 4 00:00:13,170 --> 00:00:28,110 Computer language statement basically is a group of words numbers operators that performs a specific 5 00:00:28,410 --> 00:00:29,490 task. 6 00:00:29,490 --> 00:00:38,580 Now this group of words could also include things like comments comments are basically a way of explaining 7 00:00:39,600 --> 00:00:42,920 various parts of your computer code. 8 00:00:43,290 --> 00:00:53,940 So if statements is a combination of words numbers operators and the various components that the programming 9 00:00:53,940 --> 00:00:57,650 language needs to create a program. 10 00:00:58,020 --> 00:01:03,460 So the various components of a statement can include values. 11 00:01:03,540 --> 00:01:08,910 Values are like the data that the computer program needs to function. 12 00:01:08,910 --> 00:01:11,240 For example a value could be a number. 13 00:01:11,370 --> 00:01:17,430 It could be a text which In programming terms is referred to as a string. 14 00:01:17,490 --> 00:01:19,910 It can also be expression. 15 00:01:19,920 --> 00:01:24,930 It could also be operators like a plus operator minus operator. 16 00:01:24,930 --> 00:01:30,750 Those are known as operators could be a keyword like var could be comments. 17 00:01:30,750 --> 00:01:42,120 So these are various components that you can have in a statement when the computer program runs it looks 18 00:01:42,270 --> 00:01:54,690 at the statements in the code and a runs or executes from top to bottom left to right one by one just 19 00:01:54,690 --> 00:02:02,340 to where you hopefully read the book from top to bottom computer programming is executed or runs the 20 00:02:02,340 --> 00:02:08,880 computer programs from top to bottom and from left to right. 21 00:02:09,180 --> 00:02:18,720 So usually the order is executed in the same order in which the statement is read written in computer 22 00:02:18,720 --> 00:02:28,290 programming to run the program means to execute a program a statement is just like a sentence in English 23 00:02:28,290 --> 00:02:37,620 language and just like in sentences you can have different components that make up the sentence. 24 00:02:37,620 --> 00:02:48,840 A typical computer program will consist of multiple statements I have opened up a blank web page and 25 00:02:48,840 --> 00:02:52,170 the web page is caught about column blank. 26 00:02:52,170 --> 00:02:59,460 So if you type this in to your web browser and just press enter it will give you a blank page. 27 00:02:59,490 --> 00:03:08,790 So what you gonna do is going to access the developer tool console so to do that if you just right click 28 00:03:08,940 --> 00:03:13,580 click on inspect and click on console. 29 00:03:13,620 --> 00:03:15,300 And that would give you the console era. 30 00:03:15,330 --> 00:03:21,230 So in this area here we can play around and experiment with some javascript code. 31 00:03:21,720 --> 00:03:31,890 So I'm going to write a very simple javascript statement so I'm gonna say a a to 32 00:03:36,480 --> 00:03:49,330 b times seven this is a complete statement even though it's simple it's a complete statement. 33 00:03:49,510 --> 00:03:55,900 Just like in the English language you can end your statement with a full stop in some programming languages. 34 00:03:55,930 --> 00:04:01,030 They have different punctuation depending on their language in JavaScript. 35 00:04:01,060 --> 00:04:04,990 You typically end your statement with a semi colon. 36 00:04:05,020 --> 00:04:10,160 So this is a typical valid statement in JavaScript. 37 00:04:10,180 --> 00:04:14,860 Let me quickly run through the statement with you. 38 00:04:14,860 --> 00:04:27,910 The characters a and b are called variables variables are basically like simple boxes that you can use 39 00:04:28,060 --> 00:04:37,440 to store any of your stuff in in computer programming you can use variables to store data okay in programs. 40 00:04:37,510 --> 00:04:49,150 Variables are used to hold values of value could be a number like 7 and the values are things or data 41 00:04:49,660 --> 00:04:52,130 that the program will use. 42 00:04:52,180 --> 00:05:01,170 So you can think of variables as a symbolic place holders for the values that they contain. 43 00:05:01,210 --> 00:05:13,730 Now this number 7 here is basically is a value in itself and it's called a literal value. 44 00:05:13,750 --> 00:05:22,160 This is because it stands alone without being stored in a variable. 45 00:05:22,480 --> 00:05:27,190 The course to this asterisk here. 46 00:05:27,340 --> 00:05:31,810 Both characters are called operators. 47 00:05:31,810 --> 00:05:41,960 They are used to perform actions with the values and variables such as an assignment and math. 48 00:05:41,960 --> 00:05:44,670 Mathematical multiplication. 49 00:05:44,740 --> 00:05:48,750 This equals two is known as an assignment operator. 50 00:05:49,320 --> 00:05:53,480 And this asterisk is known as a multiplication operator. 51 00:05:53,830 --> 00:06:07,290 So basically what this is doing here is saying that a is a course to the value of b times 7. 52 00:06:07,470 --> 00:06:07,890 All right. 53 00:06:07,900 --> 00:06:12,790 So once you get the value of b times it by seven and story back in a. 54 00:06:12,910 --> 00:06:15,690 That's basically what that statement is saying. 55 00:06:15,880 --> 00:06:18,010 There are different types of operator. 56 00:06:18,010 --> 00:06:28,270 This is just one that I have illustrated with now most statements in JavaScript and or are concluded 57 00:06:28,450 --> 00:06:31,220 with a semicolon at the end. 58 00:06:31,220 --> 00:06:39,000 This it's specific to JavaScript or other languages have different syntax requirement. 59 00:06:39,580 --> 00:06:52,480 So this statement K caused B times 7 basically tells a computer to get the current value that is stored 60 00:06:52,930 --> 00:06:54,930 in the variable B. 61 00:06:55,220 --> 00:07:04,390 Multiply that value by 7 then store the result back into the variable we call a. 62 00:07:04,790 --> 00:07:06,430 That's what this statement is saying. 63 00:07:07,240 --> 00:07:17,590 So programs are just a collection of many statements which together describe all the steps that it takes 64 00:07:17,620 --> 00:07:21,460 to perform a computer program. 65 00:07:21,490 --> 00:07:28,870 So you may have a basic program for example that adds numbers together so the various steps that you 66 00:07:28,870 --> 00:07:31,290 have to specify for the computer to follow. 67 00:07:31,720 --> 00:07:35,230 They are collectively referred to as statements.