All language subtitles for 011 Nested Loops_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
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

Original subtitles

A nested loop is a loop inside of another loop.

This for a loop is going to repeat code three times, but what if I placed another loop inside of it,

one that also runs code three times?

How many times is hello going to Prince?

Before I break it down for you, I encourage you to pause, take out a pen and paper and try to trace

the runtime of the code that I'm about to re display.

I hope you figure it out.

Hopefully that went well in this lesson, you're going to learn to use nested loops.

First thing you need to do is create a new class inside your Section five folder.

This file is going to be called nested loops and make sure the class has a main method.

The nested loops as an outer loop and an inner loop.

The outer loop is the big loop and the inner loop is the smaller loop inside.

This print statement is going to run nine times because each pass from the outer loop is going to run

the inner loop to completion.

The first pass is going to run the inner loop three times.

The second pass is going to run the inner loop three times.

And the third pass is going to run the inner loop three times.

In total, the nested loop ran nine times.

So a nested loops Java, I'm going to start by making a loop that runs exactly three times the loop

starts with the counter, I equaling zero, the loop is going to keep running as long as is less than

three.

And after each run, we're going to increase the counter value by one.

And so every time this loop runs, we're going to print the value of the counter during that run, so

system that out the print line run and I'll connect the counter value during that run, I.

And great, we printed the counter during the first run, second run and third run.

Now I'm going to write a for loop inside the current one.

The loop starts with the counter J equalling zero.

The loop is going to keep running as long as J is less than three and after each run, we're going to

increase the counter J value by one.

And every time this loop runs, I'm going to print the counter value.

And before I explain what's going to happen, it might be worth it to just run the code and see the

output.

And as I expect, every pass from the outer loop runs the inner loop to completion.

The outer loop started equals zero, which is less than three, so the outer loop runs Prince, the

counter value for that run, eventually reaching the inner loop inside and now the inner loop is going

to start a J.

Equals zero, which is less than three.

It's going to run print the counter value for that run.

And the inner loop is just going to keep running until Jay isn't less than three anymore.

And once that happens, the inner breaks and in turn that erupts up all the code for the first run of

the outer loop.

Now I equals one.

And this process is just going to keep repeating until the outer loop breaks.

The big picture here is that each run from the outer loop is going to run the inner loop to completion.

Now, I'm going to let this play in case you need more time to visualize what's going on.

But if you feel comfortable what we talked about so far, then feel free to skip ahead in the video.

OK, so what are some applications of nested loops, nested loops are useful when you're working with

2D arrays, you haven't learned about arrays yet, so you're not going to see nested loops for the remainder

of this section, but they are going to come back in the next section.

I can promise you that.

All righty, let's recap in this lesson, you learned how nested for loops are run.

And a nested loop has an outer loop and an inner loop, each pass from the outer loop runs the inner

loop to completion.

And that's really it, good job you covered everything there is to know about loops in Java.

It's time to build the sections Project Pocari Areto.

It's almost poker if you feel confident.

But we talked about so far, then you can feel free to skip to the next video.

But if you want to visualize the nested loop one more time slowed down without me speaking over it,

then I'll play it for the next two minutes.

All right.

See you soon.

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