All language subtitles for 009 Exercise Two (Solution)_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

Welcome to exercise number two.

So this person is 24, but they carry a lot of debt, and so naturally their application should be rejected,

but our conditionals are not working as they should, and for some reason their application gets processed.

So let's add some break points and figure out what's going on.

OK, now we're going to launch the debugger for the conditionals class and let's step through each line

and hopefully we can find some mistakes, OK?

There's the first mistake.

So apparently their credit score here is good, but we know it shouldn't be because they're adept as

four thousand dollars.

So we can stop right here and investigate.

So if this condition is true, if debt is bigger than zero, then return good, otherwise bad.

It should be the opposite.

If their debt is higher than zero, then it should return bad, otherwise good.

By the way, this.

Is the same thing is writing this, but the conditional assignment syntax is a lot cleaner, but honestly,

you don't have to use it.

It's totally up to you if you want to use a standard NFLs to assign a value between a binary number

of choices.

Power to you if you want to use conditional assignment syntax.

The ternary operators, which can be thought of as a simplified version of the default statement, then

by all means you can do that as well.

I personally prefer using the ternary operator is when it's appropriate because it's a lot cleaner and

it's less code.

In any case, you can find the syntax in your cheat sheet.

All right, let's run the code.

All right, so relaunched the debugger, maybe there's something we missed.

Oh, this is false.

It seems like we mixed up our condition because clearly a 24 year old should be old enough.

And now do you see how useful the debugging tool is?

Because from first glance, you're not going to notice the wrongful comparison operator.

But when you can see that the output is clearly wrong, then it's going to prompt you to investigate

the matter.

And in this case, we fixed the comparison.

Hopefully now everything should be good.

So apparently this works, but to run some test cases to make sure let's do an age of 16 with adeptness

4000.

Definitely shouldn't get processed.

OK, good.

Let's do 24 years old with a zero adepts.

So this application should get processed.

But it doesn't there's something wrong with our code, and I hope you can see how important it is to

run test cases, test cases are the ultimate way to really battle test your application to make sure

that everything works the way that it should.

All right.

In any case, let's launch the debugger and see what's wrong.

At this line of code can apply is true and credit score is good, but check it out.

The if statement was programmed to process applications if they're not eligible, which doesn't make

any sense, we should only process applications where the person is eligible.

And if they have a good credit.

And I think now we're ready to run the code because we've effectively debug the application.

Let's run it one more time.

Credit score equals good because debt is no higher than zero.

The person is over 18 so they can apply.

The statement should run because the person is over 18 and has good credit score.

And so we know this line is going to run.

It's pretty amazing that we can actually visualize how the code runs and how the state of our application

changes line by line.

And so for the sake of practice, let's not forget to try the other test cases.

Credit score equals bad because that is higher than zero.

The person is under 18, so they cannot apply, the statement should run if the person is over 18 and

has good credit score, but that is not the case.

So the statement runs.

All right, last test case.

This time, the credit score is good because that isn't bigger than zero, the person is under 18,

however, so they cannot apply the system and should run if the person is over 18 and they have a good

credit score.

But that is not the case, as you can clearly see.

So we know the statement runs.

OK, there you go.

I hope you enjoy this exercise.

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