All language subtitles for 009 Break and Continue_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

Break and continue, give you more control over your lupe's.

So far, you've used for loops and while loops to run code many times when you need to run code a specific

number of times, it's better to use a for loop.

And when it's not clear how many times you need to run a block of code, you have to use a while loop

because it's going to keep running your code as long as a condition holds true.

In this lesson, you're going to use the break and continue keywords inside of your loops and you're

going to see first hand how they can give us more control over them.

So the first thing you'll need to do is create a new class inside the Section five folder, make a new

file named Break and continue Java and inside the class, make sure it has the main method.

The continued keyword skips a single run you can use, continue to skip a run in the loop and continue

to the next one, I'm going to repeat this one more time.

The continued keyword skips run in the loop and it continues to the next one.

So inside Main, I'm going to write a for loop that prints the numbers zero to 10.

So the for loop is going to start with a counter that equals zero, equals zero.

The loop will keep running as long as I is smaller than or equal to 10.

And then I'll proceed to printing the counter every time the loop runs.

OK, I'll run my code.

And as you can simply expect, it prints the numbers zero to 10.

Now what if you want to get the odd numbers and only print the even numbers?

So like zero to four, six, eight and 10.

Inside the for loop, we need to check if the number is odd, if the number is odd, if the modulus

from the Vining the counter by two is not equal to zero, then skip the current run and continue to

the next one.

Let's say we reach a run with a counter equals three.

This condition is going to be true.

Continue is going to skip that run and move to the next one, not giving it the chance to print.

And ultimately, this is going to make sure that during every run where the counter is odd, the print

statement is going to get skipped.

Let's run our code.

And it prints all the even numbers, it skips every run that involves an odd number, remember that

Modulus calculates the remainder of a division.

When you divide an even number by two, the remainder is zero.

When you divide an odd number by two, the remainder is non-zero.

If the counter is zero, that's an even number, so the condition is false, bypassing the statement

and running print line.

Now, the counter is one that's an odd number, so the condition is true, the statement runs and continues,

skips the current run and moves to the next one.

Now, the counter is to that's an even number.

The condition is false, once more bypassing the statement and running print line.

Now, this animation is pretty long if you want to watch it, by all means.

But if you're comfortable with what we talked about so far, then feel free to skip ahead.

OK, let's talk about the break, key word break completely breaks the loop.

So what if I replaced the continue key word with break?

And as soon as the number is on, it simply breaks the loop.

First, we're starting at zero, that's an even number, so that condition is false, bypassing the

statements and running print line.

Now, the counter is one that's an odd number, so the condition is true, the if statement runs and

break essentially breaks the loop prematurely.

In this case, using break doesn't make any sense.

I'm in a place back to continue keyword and run my code.

And tonight, you have full control over your lupe's.

You know how to use for loops, they're uncowed a specific number of times and you know how to use while

loops to uncowed an unknown number of times.

In this lesson, you learn how to use break and continue inside your loops.

One continue executes it, skips the current and run in the loop and continues on to the next one.

And you use continue to skip a run if the cancer was odd.

Now, when break executes, break completely breaks the loop, and I think it's safe to say that you're

now an expert in loops.

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