Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In the last section, we put together our deck constructor function, which is going to be a perfect
location to create our list of 52 cards and add them all to this cards list right here before we start
just writing out some code to make that happen.
Let's take a quick look at a diagram that's going to lay out the strategy that we're going to use to
create all 52 cards in one fell swoop.
All right, so here's the idea, we're going to begin by creating two separate lists, each list is
going to contain a bunch of strings.
Now, we haven't dealt too much with lists just yet, but lists are essentially identical to arrays
in just about every other language.
So we define a list by placing some square brackets like so, and then we separate all the elements
inside of it with commas.
We're going to have one list of all the different ranks, like ACE two, three, four, five, six,
seven, all the way up to King.
And then our list of suits of hearts, diamonds, spades and clubs.
We're then going to write out a nested for loop, so we're going to save for every suit inside of this
list of suits and for every rank in this list of ranks, we're going to create a brand new card and
add it to our cards list.
And remember, the cards list is a field on the deck class right here.
OK, so let's find our constructor function.
Here it is right here, and we're going to start implementing this logic will first begin by creating
the ranks list and then these suits list and we'll put together these four loops.
So let's get to it.
All right, so I'm going to write out first my list of how let's do ranks, so let's save our ranks.
I'll place my square brackets and then I'll do ASW to.
Three, four.
Five, and I think that's probably enough, we could definitely go all the way up to King if we wanted
to, but I think five is enough and I'll do the same thing for my list of suits.
So I'll do what is it, diamonds?
Hearts.
Clubs, spades.
So then we're going to put together a double nested for loop for loops inside of Dart, again, very
similar to just about every other language out there.
So we write our four keyword and then we can vary it very easily.
Iterate over all the elements inside of one of these lists.
By placing a set of parentheses, we'll write out a variable to capture each individual element.
So I'll say for var suits in suits.
So this for Loop right here is going to iterate over every suit within our list of suits and then it
will execute the body of the for loop right here.
So then inside this for Loop, we're going to set up another one, we'll say, for every.
Rank in our list of ranks, and then right here is where we can add some code to actually go ahead and
create our new card and add it to our list of cards.
So let's take a quick pause right here.
When we come back in the next video, we're going to start adding the logic to create each individual
card.
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.