WEBVTT 00:00.210 --> 00:02.880 Everyone has a practical sense from a statement. 00:02.910 --> 00:06.190 For example if we don't have money we will not buy a computer. 00:06.360 --> 00:12.080 But how can we use these on in programming in general in order to solve complex problems. 00:12.210 --> 00:14.600 What is the philosophy behind these comments like. 00:14.740 --> 00:16.360 Let's say I am going to play it. 00:16.440 --> 00:25.200 So why do you go to x square to that's five multiplied by x 2. 00:25.350 --> 00:33.400 But first we said initialised violable X so x you've got to do it this way there is out in dividable 00:33.410 --> 00:34.850 Why so. 00:36.140 --> 00:41.790 Green light we can run this program here. 00:41.830 --> 00:44.360 We're going to observe the actual value you why. 00:44.680 --> 00:48.060 Of course we can turn to the X and they all the see. 00:48.130 --> 00:54.940 Why is why for example three or four. 00:57.300 --> 01:00.320 This is kind of cool but we haven't started programming. 01:00.370 --> 01:03.290 We agree there was a calculator there fast. 01:03.420 --> 01:08.950 When you have the ability to it no perish on the floor for example you can think a website that into 01:08.970 --> 01:14.960 your aid and gives you different content depending on your age by some structure of this month. 01:15.240 --> 01:16.460 Is Eve. 01:16.530 --> 01:21.190 Then they'd spend less than a day followed by a column. 01:21.320 --> 01:25.230 You should write the corresponding code inside the head and function. 01:25.230 --> 01:32.300 This means that it's a viable it is less than 18 you will execute the command line inside the state 01:32.350 --> 01:35.630 and you will go on with the next part of the call. 01:35.640 --> 01:37.620 First we need to read from the user. 01:37.800 --> 01:49.390 So x is equal to input and then please give me your aids or whatever and dphil around the program. 01:49.440 --> 01:50.840 We can see the computer at that. 01:50.870 --> 01:54.200 Ask for a number for example. 01:54.450 --> 01:58.190 But this is completely useless because we don't have the code to use these. 01:58.190 --> 02:01.450 Well let's try to degrade our first statement. 02:01.910 --> 02:10.320 If they'd use less than 18 column we will print you are too young. 02:12.980 --> 02:17.690 But we have a problem because we use eggs in eight states. 02:17.720 --> 02:19.040 One of these variables. 02:19.310 --> 02:21.980 So you're in the right state. 02:22.310 --> 02:23.640 Let's see this okay. 02:26.930 --> 02:29.420 I have never tried to stop this brutal. 02:29.490 --> 02:35.730 I understand why this happens by some has a very difficult system that can help you to understand the 02:35.730 --> 02:36.310 problem. 02:36.390 --> 02:43.830 You can identify the problem using the like eight that you use string and then I'm easy to aggregate 02:45.650 --> 02:51.690 indigent Stand by some roots from the use of little these by you. 02:51.900 --> 02:56.540 I don't intend to use it just by using it into function. 02:58.450 --> 03:03.830 I think this week would transform the character of 18 into the number 18. 03:03.890 --> 03:07.720 Let's end the program again. 03:08.090 --> 03:10.920 No we are not having any errors yet. 03:11.070 --> 03:14.070 You have aids 20. 03:14.600 --> 03:21.100 We will not have any method because we didn't write any code for numbers bigger than 18. 03:21.260 --> 03:23.260 But what if you wanted to send a message. 03:23.310 --> 03:24.170 He did use that. 03:24.170 --> 03:26.040 The user is older than 18. 03:26.090 --> 03:27.520 In that case we can use it. 03:27.530 --> 03:29.320 Else you come in this way. 03:29.360 --> 03:33.760 We can add more conditions to make structure that are more complex. 03:33.760 --> 03:36.840 For example you find this less than 18. 03:36.840 --> 03:43.350 I think let's see AIDS older than 18 points I think Else ponsoldt would use it as command. 03:43.400 --> 03:46.590 In the case of the howden Doesn't executed any of the cases. 03:46.640 --> 03:49.550 It will end up executing at the ends of log. 03:49.550 --> 03:54.430 For example here we can prove our code by use the LS function. 03:54.600 --> 04:06.720 So if it all died down 18 and brene GO FOR IT. 04:08.360 --> 04:09.440 Let's test it. 04:09.530 --> 04:14.230 In the case of 20 you have the correct result. 04:14.330 --> 04:17.010 What about a team. 04:17.300 --> 04:20.460 As you can see here we don't have any message. 04:20.540 --> 04:27.690 This happened because we got to the equal site so we didn't take these case into consideration. 04:29.890 --> 04:32.860 Let's try again. 04:33.190 --> 04:34.750 Nothing is out of context. 04:34.750 --> 04:40.080 Finally I should mention that of the else in this particular case we can no place else. 04:40.100 --> 04:46.690 If statements with a single else this is correct because if we don't go in the first log we will definitely 04:46.690 --> 04:53.820 go to the next one so we erase all that in the we just write the goals and the goal. 04:54.160 --> 04:56.180 And you can do it right now and end.