Afrikaans
Akan
Albanian
Amharic
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
Russian
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
Welcome back.
Before we go to the for Loop, I wanted to show you another application of the wire loop because it
will make it a little more clear what the difference is and when to use what.
So, for example, the for loop is really there to iterate through rangers' arrays and so forth.
And we will see what that means in the next video.
But before we do so, we will have to look at while loops which are great to execute a block of code
repeatedly as long as a condition is met, as we saw earlier.
So let's have an example where we don't look at numbers because so far we only looked at numbers.
We said, OK, var X, as long as X is, why, then do something.
But now let's say we have the situation where we have a variable called felt temperature and that one
will be cold.
So let's say we are in the room and it feels like it's cold.
So we don't know directly what temperature it is in terms of degrees.
Right, in terms of degrees Celsius.
So we have also a value called room temperature, which actually is that value.
So let's say 10 degrees.
And.
Now we will run a wild loop, which will increase the temperature, the room temperature, by one degree
until it's warm enough so that temperature is not cold anymore.
So here we are just going to say, as long as fildes temp is cold.
Please run this while loop, which will, as I said, increase the room temperature.
So now, of course, we still need a situation where this condition is not met any more, so we need
to create this situation so we can check if the room temperature is greater or equal 20.
Then set the felt temperature too comfy, so too comfortable, so it's not going to be cold anymore
and also print something onto the console, parental and.
It's comfy now.
So now if we execute this.
It will just print its coffee now.
Why is that what happened in this whole thing?
Well, we set the temperature too cold because when it's 10 degrees Celsius, then it's pretty cold
and we don't want to be in the room when it's that cold.
Wanted to be 20 degrees Celsius.
Which is 60 degrees Fahrenheit.
All right, so what you say is as long as it's cold, please turn up the heat.
So increase the room temperature by one.
And as soon as the room temperature hits 20 degrees.
Then said the Feld's temperature too comfy.
So now in the room, we feel like, all right is comfy.
It's a good temperature.
We can maybe even get rid of our jacket and then we can print.
It's comfy now.
And our while loop will stop, so at that point, our while loop will not increase the room temperature
anymore and it will jump out of this whole loop and execute whatever comes afterwards.
So this is just another application where you see that it doesn't have to be an integer that we're checking
here, it can be whatever condition that has to be met.
And as soon as this condition is not met anymore, the wire loop will stop executing its block here,
its body.
It's called Block.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.