All language subtitles for 007 Adding Elements to Lists_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
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
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
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

We've now got our double nested for loops put together, so we're iterating over all of the suits and

rings within this list now inside of this body right here, we need to create a new instance of a card

and then put that card into our big list of cards inside the deck.

Now, to create the new card itself, it's going to be pretty straightforward, so to make the card

we can save our card is a new card, very similar to how we've called other constructors or created

new instances of classes before.

But there's one thing I want to mention here, when we create our new card right here, we probably

want to pass in the suit and the rank that we're currently iterating over so that this newly generated

card right here knows what suit and rank it's supposed to represent.

But if you look down at our card class, we have not yet set up a constructor function on this thing.

So if we called new card right here, well, this would definitely work.

But we do not yet have the ability to pass in the given rank and suit of the card.

As a matter of fact, when I add that code in, I'm probably going to end up seeing an error.

Here it is right here.

So too many positional arguments, zero expected, but two found.

So this is complaining and saying, hey, you're passing in the rank in the suit, but the card is not

set up to expect those arguments whatsoever.

So down inside the card, we're going to add a constructor function here as well.

And we're going to make sure that if we pass in the rank and the suit, we take them and initialize

the appropriate properties on our card instance.

Now, this is another thing we did previously just a moment ago with our person class.

So we're going to write out some very similar looking code.

So inside of my card class, I'm going to add on a constructor function.

And then remember the shorthand form that we can use to take some arguments in automatically assign

them to some fields that belong to this class.

So notice that the rink is the first argument here, so I can take that first argument and automatically

assign it to this rank property here by writing this rank.

And then I'll repeat the same process for the suit as well.

So let's say this suit.

So now, whenever we call new card and passing the rank in the suit, those two properties will be automatically

assigned to the relevant fields on the card instant's.

So now we've got the appropriate card created here, and this code right here is going to run 52 times

once for every combination of suit and rank.

Well, for me, not 52, two times.

But you get the idea.

So now that we've created the card, we need to take that card and add it to our list of cards to add

a new element to a list, we can reference the list itself, which is going to be in this case, simply

cards.

Remember, in part, we don't have to say this cards or anything like that.

We optionally can, but we do not have to.

So I'll simply say cards and then to add a new element, I'll say add.

And then I'll pass in the element that I want to add to that list like so.

OK, so this is looking pretty good.

I am going to tell you that there is a very subtle air inside this code right now.

So there's a very small bug.

Let's add in a new main function to this file so that we can test out this new debt class.

And then when we run that code, we're going to see that air kind of a peer or the very subtle bug appear.

And we'll take a quick pause and talk about what's going wrong.

So let's add in the main function at the very top up here.

I'll add in void main.

And I'll just create a new deck by writing out new deck, and then we don't have to actually do anything

with that, I just want to run the constructor function.

OK, so I click on Ron.

And then you're going to notice an error message on the top right up here, it says Dot ad is not a

function.

OK, so like I said, very subtle error in here.

So let's take a quick pause.

We'll come back to the next section and try to figure out exactly why we saw this error message.

So quick break and I'll see you in just a minute.

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