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
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
So what types of loop's we may have, actually, we may have a few different types of looping control
structures, such as while loops do while loops and Forell loops.
And although all of them are used with the loops context, some are better for one thing, while others
are better for a another.
It simply depends on the task.
It's just the the the way you control how to iterate, how to run your loop.
That's basically what is different between them.
And in these video, we are going to focus and we are going to talk about the first one.
The while loop, some of the while loop is one of the first loops being taught.
And the reason for that is because this type of loop is probably the easiest one.
So how it's structure looks like, first of all, you specify that it's a while loop, right.
That we are using gay while loop.
By using this statement while then you write down the loop conditions.
So a while loop has its own condition and did the result of this condition happens to be true?
If it happens to be true, then we are going to execute the associated block of commands.
Or is it also called the loop body?
The loop commands and we can think of the loop body as we can see it in this illustration is some different
tasks that these guy has to do.
For example, he has to talk on the phone, listen to customers, try to find bugs in his code and so
on.
So that would be the loop body.
For example, these guy comes to work and as long as some condition happens, as long as it's true,
he executes all the commands, all his tasks that are a specified thing, the loop body.
Now, maybe this illustration looks kind of funny for you, but we are going to see in the next chapters
why we kind of dwell on these kind of explanations.
Sand.
You are going to understand that starting these months, you are yelling that way is much easier.
It's much easier.
Guys, trust me and you will get much more out of it right then instead of just going out and see how
it will look like in our code and how what what you say.
Right.
OK.
Understand the concepts behind every section.
And it will take you much, much less time to get a hold of everything else.
And lastly, using Goller while loops, we are going to execute these commands in the loop body that
you can see on the right.
As long as the condition of these while loop happens to be true.
So when it happens to be false, we are going to stop executing these low body, these commands inside
of it.
We will see in the next examples how it will look like also in our code.
So things are going to be much more clear to you.
But before we do so, let's explain this illustration once again.
We can say that these guy let's call him Jacob.
Jacob comes to work here on the left.
And while a certain condition is not false.
For example, while his shift is not over.
He's going to execute the loop body tasks.
Is that clear?
So he goes to work checks if the shift is not over yet.
And the result for that, he's going to be true.
It's not over yet.
Then he does these tasks of going on the phone, fixing some bands, writing some code and so on.
And afterwards, once he's down one iteration, we are going to explain it right away.
Once you're done one cycle of this loop, he's going to ask the same question in the same condition
once again.
So if his shift at work is not over, he is going to iterate and to run this low body once again.
He's going to do he's it's a cycle of tasks.
Once, once again, and as long as the result of the question will be true, meaning that the shift
is not over.
Jacob is going to do all of his tasks once the result of the condition will be false.
Then Jacob in this case will go home and not run the loop body again.
He will not do any of these phone calls.
He's done for today.
He can go home.
And by the way, we can see that Jacob here on the right.
He kind of gets mad at work.
So don't get mad at war, guys.
And it won't help you at all.
Simply calm down.
Drink some tea and move on with your task with a smile.
So now let's get back to our while loop.
And we can say that when the condition of the while loop is false, then we just skip all the while
code and we will see how it looks like in our programming language and move on with our program with
whatever commands may appear afterwards.
We are out of the slope when the condition is false.
So I hope that's clear.
And last.
Note for this video is that the execution of Luke Buddy, one cycle of the Luke body, before we check
the condition once again, one cycle from top to bottom just once is called an iteration.
And basically a loop can have multiple iterations as part of it.
Right.
As long as the condition is not false.
So let's take another a look and see how it will more resemble to our program.
So there is zero code.
Different commands.
And there we come to a certain point where we see the wild statement.
OK.
So we are doing a lot of war.
Jacob is at work.
He's working.
That's another example.
Another illustration.
Jacob is working.
And we come to a point where we are going to use the while loop.
So we we ask the question, the condition.
We check this while loop condition.
Does Jacob need to finish his work?
And if this condition happens to be true, then we are going to execute some specific commands specified
in the loop body.
We do one iteration of the loop, just one iteration job.
Jake, Jacob is just going to to keep working to execute some more tasks at his work.
And once he's done executing these specific commands that he had to do, we are going back to check
once again.
If the condition is true or false, does Jacob need to finish his work?
And if the condition is still true, then we are going to execute this code once again.
And basically, we are going to repeat this whole process this cycle until the result of the condition
is going to be false.
So once the result of the condition is false, we can get out of the loop and proceed with our program
and our other commands and then we can say that Jacob can go home.
So that's basically the general structure of while loops are used here, a couple of illustration visualization.
Call it whatever you like.
That may help you a little bit understand the concept behind it.
And we will see more practical, practical examples in this section.
But still, I think it's nice to understand this loop structure a general.
Before we dive into programming.
So now let us see how it can be used in our programming language.
Right away.
I'll see you in the next video by.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.