All language subtitles for 010 Debugging Functions_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 lot of the times your function is not going to return the correct value.

So in this lesson, you're going to learn to debug functions by using breakpoints.

Once again, the code you're going to open isn't going to behave the way that you want it to.

So I'll give you a few seconds to pause and read this description.

And now, based on the description you just read, the starter code should place Gryffindor in first

place, but if we actually run it.

They are in fourth.

Something is wrong and using breakpoints, we can visualize the runtime.

OK, well, there's the first mistake, Gryffindor won by 400 points, but the points margin indicates

that they lost by 400.

We need to reverse the operation and this is a very common type of accidental mistake that you can easily

identify when you visualize the runtime.

So let's launch another debugging session.

And the final up, but it's three, but since Gryffindor is ahead by more than 300 points, they should

be in first place to find out what's going on.

We need to step into the function.

When a breakpoint hits the function call, you can step into it.

So restart the debugging session.

Once the breakpoint hits the function, you can step into its.

And after you step into the function, it evaluates the first condition.

For us, the second one.

True.

And they return three.

It stores the return value in the variable ranking.

Which we then printed.

So we need to rearrange the conditions to go from highest to lowest.

All right, now it returns the correct results.

Now we're going to run some test cases and use break points to visualize each runtime will change.

Gryffindor points to eight fifty rather than clode to five hundred.

That should put Gryffindor in first, let's try it out.

OK, good.

Now we'll do 620 and 500 should put them in second.

OK, great.

We'll do 450 and 500, I should put them in third.

Nice.

Then we'll do a hundred and five hundred and I should put them in last.

And indeed, it does.

Now, if you want to explore the hidden world of Java, you can step into built in functions.

I can step into print line.

And this is the code that runs behind the scenes to print your code.

I can step into that random.

Interesting, it returns the next double that the random number generator produces, OK, makes sense.

I can step into math that, Max.

And this syntax is very interesting.

It's called conditional assignment, and I made you use it in the last exercise.

Basically, it checks if value A is greater than or equal to be.

If it's true, Gever returns the value that follows the questionmark.

Otherwise, Javor returns the value that follows the colon.

B. In this case, the condition is false.

So it's going to return B.

All right, one more thing, notice that Java documents every function.

This function takes two parameters and returns the larger of Perram, A and B, very similar to how

we do things pretty cool.

All right, we used breakpoints to debug a function.

You visualized how a function runs by stepping into it, and if you're curious about built in functions,

you can step into those as well.

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