All language subtitles for 013 If Statements__en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt-PT Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,240 --> 00:00:01,060 Welcome back. 2 00:00:01,080 --> 00:00:07,140 In this video, we are going to use if statements and we are going to finally make use of what we've 3 00:00:07,140 --> 00:00:11,780 learned so far, for example, the comparison operators, which are very useful when it comes to if 4 00:00:11,910 --> 00:00:12,590 statements. 5 00:00:12,720 --> 00:00:17,120 So we had this comparison operator, we said five, equal equal three. 6 00:00:17,310 --> 00:00:21,150 And then if that was true, we can now go ahead and execute something. 7 00:00:21,540 --> 00:00:25,490 So now let's go ahead and create an if statement here. 8 00:00:25,800 --> 00:00:32,970 And before we do so, I'm going to create a little variable called height person one and it's going 9 00:00:32,970 --> 00:00:36,390 to be something like one hundred and seventy. 10 00:00:36,960 --> 00:00:37,590 And then. 11 00:00:38,530 --> 00:00:46,150 Maybe it should be written correctly and then I have another one white person, too, should be something 12 00:00:46,150 --> 00:00:47,740 like one hundred and. 13 00:00:48,750 --> 00:00:49,450 Eighty nine. 14 00:00:49,680 --> 00:00:55,240 All right, so these are centimeters for those of you who aren't aware of what I'm talking about. 15 00:00:55,260 --> 00:01:02,040 So one hundred and seventy centimeters and 189 centimeters, I think that's something like five. 16 00:01:03,180 --> 00:01:05,800 Seven or five, eight or something like that. 17 00:01:05,940 --> 00:01:11,580 And then this should be, um, six three in terms of feet and inches. 18 00:01:12,030 --> 00:01:12,380 All right. 19 00:01:12,390 --> 00:01:16,110 So these are the two person high person, one injured person, too. 20 00:01:16,150 --> 00:01:22,580 So we have two people and we want to execute something based on a condition. 21 00:01:22,590 --> 00:01:26,370 So if a person one is taller than person two. 22 00:01:27,290 --> 00:01:30,620 Then we're going to use raw force in order to beat it. 23 00:01:30,650 --> 00:01:36,570 Let's say we have a fight between two people and now we have to decide what kind of technique we want 24 00:01:36,810 --> 00:01:37,310 to use. 25 00:01:37,340 --> 00:01:43,450 So let's say our fighter is 170 and the opponent is one eighty nine. 26 00:01:43,460 --> 00:01:44,580 So what should we do? 27 00:01:44,930 --> 00:01:49,850 Shall we either use raw force or shall we use technique? 28 00:01:50,490 --> 00:01:57,710 Of course, a combination of both will be useful, but then we're going to check if height person one 29 00:01:58,250 --> 00:02:01,190 is greater than height. 30 00:02:01,190 --> 00:02:02,080 Person two. 31 00:02:02,900 --> 00:02:09,320 I simply want to print something like use raw force. 32 00:02:10,940 --> 00:02:18,140 All right, so let's say let's assume that if someone is taller than he's also going to be stronger 33 00:02:18,140 --> 00:02:24,070 because he's going to have more weight and that is going to be very useful in a one on one fight. 34 00:02:24,770 --> 00:02:25,430 But now. 35 00:02:26,370 --> 00:02:30,510 If we execute this line of code, we will see that pretty much nothing will happen because the condition 36 00:02:30,510 --> 00:02:31,130 isn't met. 37 00:02:31,140 --> 00:02:33,090 So we have this condition of high person. 38 00:02:33,090 --> 00:02:34,950 One shall be created in high person, too. 39 00:02:34,960 --> 00:02:40,920 But if you look at the values, we will see that that is not true because 170 isn't higher than one 40 00:02:40,920 --> 00:02:41,520 eighty nine. 41 00:02:41,520 --> 00:02:43,980 So we can see we get nothing here printed. 42 00:02:44,460 --> 00:02:52,800 So now let's say the other way around, what should happen if a person one is less than hyd person too? 43 00:02:53,460 --> 00:02:57,180 Well, that's something that we can use with an else statement. 44 00:02:57,600 --> 00:03:01,100 OK, so in this case it's either if or else. 45 00:03:01,320 --> 00:03:07,010 So if this condition is met, then execute the code that is within those curly brackets. 46 00:03:07,530 --> 00:03:13,080 And if the condition is not met, then run the else block, which means run the code, which is within 47 00:03:13,080 --> 00:03:14,320 those curly brackets. 48 00:03:14,640 --> 00:03:19,220 So here I'm just going to say use technique. 49 00:03:20,040 --> 00:03:20,540 All right. 50 00:03:20,550 --> 00:03:25,580 So now let's run this again and see if anything will be printed whatsoever. 51 00:03:26,530 --> 00:03:33,910 And we can see it says use technique, so because our person one was smaller than the other one, we 52 00:03:33,910 --> 00:03:40,030 advise him to use his best techniques instead of trying to apply real force when fighting one on one, 53 00:03:40,720 --> 00:03:44,680 because we one hell of a coach and want only the best for our fighter. 54 00:03:45,900 --> 00:03:52,320 But what will happen if they are both the same size, so let's say we have the situation where both 55 00:03:52,320 --> 00:03:53,760 are actually the same size. 56 00:03:54,000 --> 00:03:58,620 Is there any special advice that we can give our fighter, if you will, on this example? 57 00:03:58,620 --> 00:04:05,190 It's rather weird to have such a situation, but let's just say we have this other. 58 00:04:06,710 --> 00:04:07,340 Condition. 59 00:04:07,550 --> 00:04:14,420 So what you can do is you can have an else, if so, there are three different types of checks. 60 00:04:14,420 --> 00:04:19,519 So the IV check, then the elusive check, and then finally the else, which is not really a check, 61 00:04:19,519 --> 00:04:25,070 but which is a code that will be executed as a default if none of the above are true. 62 00:04:25,340 --> 00:04:26,870 So what does that even mean? 63 00:04:27,200 --> 00:04:31,370 Well, let's say we have an elective in between here. 64 00:04:31,640 --> 00:04:34,220 So let me show you. 65 00:04:34,340 --> 00:04:37,630 So we have an else if again, with a condition. 66 00:04:37,940 --> 00:04:42,020 So here I'm going to say that those two have the same height. 67 00:04:42,200 --> 00:04:43,940 So equal. 68 00:04:43,940 --> 00:04:44,240 Equal. 69 00:04:44,990 --> 00:04:45,520 All right. 70 00:04:45,890 --> 00:04:50,660 So we had this first condition here, which was person one greater than that, person two. 71 00:04:50,930 --> 00:04:57,860 Then we had the second condition here, which was high person one is equal to person two when it comes 72 00:04:57,860 --> 00:04:58,990 to his size. 73 00:04:59,000 --> 00:05:04,700 And then we can execute some code if that condition is met in here. 74 00:05:05,180 --> 00:05:16,390 So let's just say something like use your power technique one three three seven, something like that. 75 00:05:16,400 --> 00:05:22,190 So the fighter has a power technique and it's very useful against people who are the same height as 76 00:05:22,190 --> 00:05:22,600 he is. 77 00:05:23,060 --> 00:05:24,830 So you should use that technique. 78 00:05:25,580 --> 00:05:29,530 But then we have this else block which will be executed if none of the above are true. 79 00:05:29,540 --> 00:05:36,320 So if neither this if statement or this condition here is true, nor this condition here is true, then 80 00:05:36,320 --> 00:05:38,350 the else block will be executed. 81 00:05:38,690 --> 00:05:43,970 So then the text use technique will be executed instead. 82 00:05:45,500 --> 00:05:52,970 Now, the cool thing is you can have as many electives as you want, so we could go ahead and check 83 00:05:52,970 --> 00:06:00,290 if the height of person one is greater than 150 and execute some code, then check if what what should 84 00:06:00,290 --> 00:06:08,570 happen if the person is smaller than 140 or all kinds of combinations that we can think of, even though 85 00:06:08,570 --> 00:06:14,660 we have to be careful that certain conditions don't overlap with each other, because if they overlap, 86 00:06:14,660 --> 00:06:16,160 then one of them will be useless. 87 00:06:16,820 --> 00:06:23,420 OK, so what we have here, if we execute this, let's say when the person's one more person, one in 88 00:06:23,420 --> 00:06:29,540 person, two are both one 170, then it should display use your power technique one three three seven. 89 00:06:30,320 --> 00:06:33,320 So that we are it says use your power technique one three three seven. 90 00:06:33,590 --> 00:06:34,320 So let's say one. 91 00:06:34,370 --> 00:06:41,330 The person two is smaller than the person one then it should say use. 92 00:06:43,010 --> 00:06:43,760 Raw force. 93 00:06:46,100 --> 00:06:48,500 So that we are using your force. 94 00:06:50,530 --> 00:06:57,550 All right, and what you see here, so this whole if else, if stuff is a controlled flow and we're 95 00:06:57,550 --> 00:07:04,210 using if statements here now, little challenge for you, please go ahead and create an if else, if 96 00:07:04,210 --> 00:07:10,630 else, if else, block where the first check will be greater equal 21. 97 00:07:11,080 --> 00:07:15,460 And if that's the case, then it should write something like or print something like. 98 00:07:15,730 --> 00:07:25,160 You may drink in the US then or else if the H is greater equal than 18, then you may vote. 99 00:07:26,080 --> 00:07:30,380 And if somebody is older than 16, you may drive. 100 00:07:30,790 --> 00:07:36,220 And then finally, if none of the above is true, then it should print something like you were too young. 101 00:07:36,340 --> 00:07:43,360 So try to use this kind of structure to print those different statements based on a variable called 102 00:07:43,360 --> 00:07:45,550 age that you, of course, also need to create. 103 00:07:46,270 --> 00:07:47,680 So go ahead and try that. 104 00:07:49,410 --> 00:07:54,390 All right, so I hope you pass the video, so I'm going to create this variable called H and actually 105 00:07:54,390 --> 00:07:57,560 I'm not going to change it so I could go ahead and use a Veldheer. 106 00:07:57,930 --> 00:08:02,940 So the variable will be H and then I use an if statement here. 107 00:08:03,960 --> 00:08:07,590 If H was greater equal 21. 108 00:08:08,860 --> 00:08:18,760 Then I want to print something saying now you may drink in the US because in other countries you may 109 00:08:18,760 --> 00:08:19,900 drink before that, right? 110 00:08:20,470 --> 00:08:26,410 If you do that, then in our case, of course, this will not be printed because age is not greater 111 00:08:26,410 --> 00:08:27,610 than 21. 112 00:08:28,630 --> 00:08:30,820 Let's have another check. 113 00:08:30,820 --> 00:08:37,690 So else if the age is greater, equal 18. 114 00:08:38,570 --> 00:08:40,880 So what should be printed if that's the case? 115 00:08:41,539 --> 00:08:45,200 Well, let's print something like you may vote now. 116 00:08:46,590 --> 00:08:58,890 All right, Prindle, and you may vote now and then we have another check age greater equal 16 and then 117 00:08:58,890 --> 00:09:00,300 in the US you may drive. 118 00:09:00,300 --> 00:09:00,600 So. 119 00:09:00,600 --> 00:09:05,120 Prindle And you may drive now. 120 00:09:05,450 --> 00:09:10,380 Of course, you need a license for that, but at least you can make the license or do the license at 121 00:09:10,380 --> 00:09:12,870 this point and then you can use it. 122 00:09:13,290 --> 00:09:18,000 And then finally we have an ELT's block which will be executed if none of the above is true, which 123 00:09:18,000 --> 00:09:19,800 means if the person is. 124 00:09:21,060 --> 00:09:24,720 15 or younger, then it should say something like. 125 00:09:25,960 --> 00:09:30,310 You're too young to do whatever. 126 00:09:30,340 --> 00:09:35,050 All right, so if we run this, you probably already guessed it, it will print. 127 00:09:35,050 --> 00:09:38,080 You may drive now because our age is 17. 128 00:09:39,300 --> 00:09:42,850 All right, so let's run this and there we are. 129 00:09:42,870 --> 00:09:45,330 So it says you may drive now. 130 00:09:47,000 --> 00:09:50,570 Now, if the age is that's a 31 as I am. 131 00:09:51,840 --> 00:09:55,740 You can see it says now you may drink in the US. 132 00:09:56,950 --> 00:10:02,500 All right, so, of course, I can do all of the others information as well, so I also may vote, I 133 00:10:02,500 --> 00:10:04,330 also may drive now and so forth. 134 00:10:04,610 --> 00:10:08,130 Of course, I could adjust the print statements here accordingly. 135 00:10:08,470 --> 00:10:13,960 But this is the latest thing, so to speak, that I can do due to my age. 136 00:10:14,000 --> 00:10:14,400 All right. 137 00:10:14,950 --> 00:10:22,660 So we have this if else if else block that we can use in order to execute stuff when certain conditions 138 00:10:22,660 --> 00:10:23,170 are met. 139 00:10:23,740 --> 00:10:29,020 Now, by the way, a thing that you can also do if you have a very basic if statement. 140 00:10:29,030 --> 00:10:34,830 So let's say you only have one line of code that follows a condition. 141 00:10:34,840 --> 00:10:38,500 So H is creature equal 30. 142 00:10:40,630 --> 00:10:47,500 Then you can just go ahead and do or add the text in the next one, you're over 30. 143 00:10:49,380 --> 00:10:53,770 All right, so that's something that you can, of course, also do directly. 144 00:10:54,570 --> 00:10:59,330 So just one line of code without having these extra curly brackets around it. 145 00:10:59,550 --> 00:11:02,490 So if you see anything like that, that's what it does. 146 00:11:02,800 --> 00:11:05,370 But you have to be careful because in the next line. 147 00:11:05,760 --> 00:11:10,080 So if I add something like this in the next line. 148 00:11:11,220 --> 00:11:15,750 This line will not be part of this if statement, so it will be executed either way. 149 00:11:16,800 --> 00:11:18,240 So be careful here. 150 00:11:19,640 --> 00:11:26,660 All right, so these are the statements, and in the next video, we're going to look at one because 151 00:11:26,660 --> 00:11:28,960 you might see already that it's complaining. 152 00:11:28,970 --> 00:11:32,630 So it says Kaskade IV should be replaced with one. 153 00:11:33,140 --> 00:11:34,840 So let's do that in the next video. 154 00:11:34,850 --> 00:11:35,540 So see you there. 14986

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.