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 when will we want to use conditions in what situations?
Think, for example, that we would like to develop a program that will get your grade on your last
exam?
And suppose you would like to make this program a really cool one.
Such a program that will preened congratulations.
Message to the screen.
If you've actually passed the exam.
But if you didn't pass, meaning that their input rate was insufficient, let's go this way.
You will print a failed try again message.
And I would like you to take a couple of minutes to just think of this question.
Could you accomplish it?
Do you think you can write the code for it?
I mean, right now.
So give it a shot.
Would you?
And once you're back.
Basically what we can see here on the screen is that we have two different programs on the left and
on the right side.
And both of these programs read the input from the user.
And then one of these programs preens congratulations, message to the screen while the other one preens
failed.
Try again, message.
But if you take a look at them separately, they are not so useful.
Right.
That's why we should aim to combine them into just one program.
So we will take the failed DRÉ again message and just move it to the left.
Just added to this program.
And now we have both of these messages just in one place.
But this probably you can see, unfortunately, if we tried to run these program as is.
You will simply see that you're getting an input from the user, which works fine.
And then you just print congratulations as well as failed.
Try again, message.
And that doesn't make any sense, though, to print both of these messages, one after the other.
So, guys, that's exactly why we need some control here in this control is actually something new.
We haven't used it in previous sections.
We didn't see any examples in which we were testing any conditions.
All we were just doing is simply running some lines of code, getting inputs and giving output commands
one after the other.
So how should we add these controlled while program?
And it basically should work like this in both situations.
We will still need to read some inputs.
Right.
So these parties, these a must.
And it has nothing to do with any condition.
And now comes the real question.
How will you print congratulations if they received grade equals or higher than, let's say, 60 and
print a field, try again.
Message if they received rate is below is lower than 60.
So for that, we will need to ask the help of these guy who will be in charge of all the control flow
in our program.
He will decide on what path should we take next based on the result of some condition.
So basically great equals or a higher than 60.
Meaning that the result of this condition is true.
Then we will run the code on the left side and print congratulations message to the screen.
And be very happy about it.
But if the result of the condition is false, we will run the code on the right side and print a failed
try again message and be very, I don't know, unhappy about that, that we failed the test.
So basically all this guy does is simply deciding what parts of code.
What specific commands should be executed based on the result of the given condition.
In this case, it's just if a grade is equals or higher than 60.
So once again, just to make that clear.
If the grade is higher or equals to 60, then we will run the code on the left and print a congratulations
message to the screen.
Otherwise, if the grade is not enough to pass the exam, we will run the code on the right and print
a field.
Try again message.
So now we simply do not print both of the messages as we've done it previously.
We are just executing the relevant part of the code based on the result of this condition.
So this is it for these video guys.
And I really hope that by taking a look at these previous simple example, you've got the point and
the reason why we need to use condition and control flow.
And now let's see how we can take this example and implemented in our programming language.
So I'll see you in the next video.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.