All language subtitles for 4- While

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
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 Download
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: WEBVTT 1 00:00:00.000 --> 00:00:04.000 In the last lecture, 2 00:00:04.000 --> 00:00:08.000 we wrote this for loop to display all the odd numbers 3 00:00:08.000 --> 00:00:12.000 between 0 and 5. And in this lecture, I'm going to show you how to 4 00:00:12.000 --> 00:00:16.000 implement the same logic by using a while loop. Now one 5 00:00:16.000 --> 00:00:20.000 key difference between a y loop and a for loop is that in for loops 6 00:00:20.000 --> 00:00:24.000 the loop variable is part of the loop variable itself. 7 00:00:24.000 --> 00:00:28.000 But in y loops, you have to declare this y variable externally. Let me show 8 00:00:28.000 --> 00:00:32.000 you what I mean. So we start with declaring 9 00:00:32.000 --> 00:00:36.000 a variable like i and set it to 0. Note that this 10 00:00:36.000 --> 00:00:40.000 i we have here is different from the i we have in this for loop, 11 00:00:40.000 --> 00:00:44.000 because this variable is only meaningful and accessible 12 00:00:44.000 --> 00:00:48.000 inside of this for loop. This is called scope, and I'm going to talk about 13 00:00:48.000 --> 00:00:52.000 it later in the course, all I want you to know is that these two 14 00:00:52.000 --> 00:00:56.000 variables are completely different, even though their names are the same. 15 00:00:56.000 --> 00:01:00.000 Now, we have our loop variable initialized to 0. 16 00:01:00.000 --> 00:01:04.000 Next we add a while statement, 17 00:01:04.000 --> 00:01:08.000 in parenthesis we need to add our condition. What is the condition 18 00:01:08.000 --> 00:01:12.000 here? That is i less than or equal 19 00:01:12.000 --> 00:01:16.000 to 5. So I'm going to add that here. Next, 20 00:01:16.000 --> 00:01:20.000 we need to add our statements. So what is the statement that 21 00:01:20.000 --> 00:01:24.000 we want to repeat, here's the statement, we want to display 22 00:01:24.000 --> 00:01:28.000 the odd numbers, so we add that here as well, 23 00:01:28.000 --> 00:01:32.000 and finally, at the end of this while block we need 24 00:01:32.000 --> 00:01:36.000 to increment i. So this is a direct translation 25 00:01:36.000 --> 00:01:40.000 of this for loop into a y loop. 26 00:01:40.000 --> 00:01:44.000 So this is what happens when we execute this code. Initially I 27 00:01:44.000 --> 00:01:48.000 is 0, now in the y loop, first this condition 28 00:01:48.000 --> 00:01:52.000 is evaluated, if this condition is true, then the 29 00:01:52.000 --> 00:01:56.000 body of the y loop will be executed. Again, in the next iteration 30 00:01:56.000 --> 00:02:00.000 the condition is evaluated again, if it's true, the 31 00:02:00.000 --> 00:02:04.000 statements in the y block will be executed, otherwise the while block 32 00:02:04.000 --> 00:02:08.000 will terminate. In the next lecture we're going to look at another kind of 33 00:02:08.000 --> 00:02:11.200 loops in JavaScript. 2913

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