All language subtitles for 005 if statements_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
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
hmn Hmong
hu Hungarian Download
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
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
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 Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
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,180 --> 00:00:05,970 If statements can use comparisons to control the flow of your code, a comparison is only useful when 2 00:00:05,970 --> 00:00:07,350 it's inside of an IF statement. 3 00:00:09,640 --> 00:00:13,480 So in this lesson, you're going to use statements to control how your code runs. 4 00:00:16,379 --> 00:00:21,750 As usual, we're going to start by creating a new class inside the Section three folder, create a new 5 00:00:21,750 --> 00:00:25,740 file named FLC Java and make sure the class has a main method. 6 00:00:31,960 --> 00:00:35,100 The if statement runs, it's code only if a condition is true. 7 00:00:36,730 --> 00:00:42,280 This is a comparison, but when a comparison is inside of a statement, we call it a condition. 8 00:00:45,270 --> 00:00:51,210 There are two parts to in a statement, the condition which can be true or false and the code inside 9 00:00:51,780 --> 00:00:54,150 which only runs if the condition is true. 10 00:00:57,490 --> 00:01:03,520 So inside of Java, we're going to make an invariable that stores a student's grade into grade is equal 11 00:01:03,520 --> 00:01:04,510 to 65. 12 00:01:10,350 --> 00:01:15,780 Then we're going to make an if statement if and inside the brackets, we're going to read a condition 13 00:01:15,780 --> 00:01:18,960 that checks if a grade is greater than 50. 14 00:01:22,730 --> 00:01:25,820 And inside the if statement, we're going to print. 15 00:01:28,770 --> 00:01:29,760 Great job. 16 00:01:32,070 --> 00:01:32,880 You passed. 17 00:01:37,270 --> 00:01:39,550 This code will only run if the condition is true. 18 00:01:41,950 --> 00:01:43,300 So we're going to run our code. 19 00:01:51,290 --> 00:01:53,480 And it ran the code inside the statement. 20 00:01:55,030 --> 00:01:59,690 That's because the grade 65 is bigger than 50, which makes the condition true. 21 00:02:00,340 --> 00:02:02,980 So the code inside the if statement runs. 22 00:02:08,830 --> 00:02:11,140 Now we're going to change the students grade to 45. 23 00:02:16,460 --> 00:02:17,510 Rewrite our code. 24 00:02:20,520 --> 00:02:21,900 And nothing happens. 25 00:02:23,840 --> 00:02:27,110 The grid is not bigger than 50, which makes the condition false. 26 00:02:27,440 --> 00:02:29,150 So Java skips the code. 27 00:02:32,770 --> 00:02:36,370 When the if condition is false, Jova runs the false statement. 28 00:02:40,670 --> 00:02:46,780 And if a statement looks like this, there is an if statement with a condition and an el statements. 29 00:02:51,260 --> 00:02:54,140 And when the condition is true, Juvy runs the estimates. 30 00:03:01,020 --> 00:03:05,970 And when the condition is false, Java skips the statement and runs the code inside else. 31 00:03:10,640 --> 00:03:16,910 So back in our code, if a student scores under 50, we want the app to say study hard next time, so 32 00:03:16,910 --> 00:03:18,350 we're going to add an else block. 33 00:03:21,150 --> 00:03:24,210 And inside will print study hard next time. 34 00:03:29,850 --> 00:03:30,930 Rerun your code. 35 00:03:36,200 --> 00:03:42,170 And this time the code inside the statement runs, never going to change the grade back to 65. 36 00:03:43,220 --> 00:03:44,540 We run your code once more. 37 00:03:47,820 --> 00:03:50,910 And this time at Prince, great job you passed. 38 00:03:54,550 --> 00:04:00,340 We need to be careful about putting in the right condition, let's assume that if 50 percent warrants 39 00:04:00,340 --> 00:04:04,300 a pass, but our condition checks if the grid is greater than 50. 40 00:04:06,370 --> 00:04:10,750 I'm going to change the grade to 50 and see what happens, rewriting my code. 41 00:04:14,340 --> 00:04:17,040 And that's not good, the condition is false. 42 00:04:17,070 --> 00:04:18,510 So the student fails. 43 00:04:22,170 --> 00:04:27,480 We need to fix our conditions is that the student policies, if they're great, as greater than or equal 44 00:04:27,480 --> 00:04:28,110 to 50. 45 00:04:29,270 --> 00:04:30,500 Let's rerun the code. 46 00:04:32,090 --> 00:04:34,910 And right on the student pass with a D minus. 47 00:04:36,750 --> 00:04:42,390 In this case, the grid is equal to 50, so the condition is true and this runs the code inside the 48 00:04:42,520 --> 00:04:43,200 statements. 49 00:04:47,230 --> 00:04:50,830 In this lesson, you learn to use if statements to control how your code runs. 50 00:04:52,690 --> 00:04:55,510 When the condition is true, Jova runs the if statements. 51 00:04:58,460 --> 00:05:03,470 When the condition is false, Java skips the statement and runs the code inside ls. 4846

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