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
What is going on, guys?
I hope you're doing well, getting a hold of all the new concepts.
We are learning in this chorus and in this video we are going to move even a step further with the control
flow topic.
So let's, first of all, review what we've done so far.
We used the basic live condition and based on its result, which was true or false.
We've executed some associated commands depending on the result of the condition.
You do remember that, right?
And we've seen a couple of examples, like when we wanted to find out what is the maximum value and
wanted to give a number is number one.
And number two, we asked if no one was greater than number two.
And if that's the case, if the result of this condition is true, we would have printed that the maximum
is number one.
Otherwise, we would have printed on.
Right.
Otherwise, if the result of the condition was false, we would have printed the maximum is number two.
So we basically will run different commands, different parts of code based on the result of a given
condition.
And also, we've seen an example where we tested out if a number forgiven number was even or odd.
We've seen how to test it.
We simply checked with the remainder of the division by two will be either a one or a zero.
And then based on the result we printed out.
If the number is even poorer.
The number was odd.
All right.
So I hope you got the whole idea of this, because it's very important that you didn't miss anything
that we said previously.
It was just a reminder for you guys.
Before we move on.
Right.
We moving forward in these control flow topic.
So now what I want us to do is to take a look at the following example.
So let's take a look at this exercise and it goes like this.
First of all, get a grade from the user.
All right.
Once again, get the users grade.
And if the grade is 80 or higher, we will print.
Excellent job message.
Otherwise, if the grade is not 80 or higher, meaning it's less than 80.
But yet it may be 60 or higher.
We will print not bad, but study a little bit more next time.
Message or write any of the grade is less than 60.
Meaning the two previous conditions didn't was not.
We're not satisfied.
We will print the following message.
Oh, you didn't pass something like that.
Try again next time.
All right.
Do your best for the next exam.
So if you take a closer look at this exercise and you can see basically that a simple if el statement,
just as we used previously, he's just not going to be enough in this case.
We've used here some more or let's say modified approach.
The LC approach, which is also sometimes called a nested condition.
And the reason for that is because we nest.
One condition into the other.
And let's see basically how it looks like the first condition was if Grady's 80 or higher.
And then the else of this result, meaning the grade maybe probably is less than 80.
But we still use the else if statement and we checked out if the grade, maybe it's less than 80.
But it still may be 60 or higher.
All right.
And if that's also not the case, then we are moving to the third through the force option in this case.
When we have the grade less than 60.
So just to make it clear.
Let's go over the flow once again, step by step.
All right.
So we got our great input.
That's the first step.
Get the grade from the user.
Now we use the condition to see if the test was good and if the grade is 80 or higher.
All right.
If grade is 80 or higher.
This is our condition.
This case is the result of this particular condition is true.
Then let's simply print some congratulations message and print to the user.
Some excellent job.
You've done great on your last exam.
All right.
But if the resolved.
This is not true.
Which leaves us with the fact that the result is false.
And now, at this point, as opposed to two different examples we've seen so far, we would like to
use another condition, a nested condition.
So we use the following condition to ask if grade is 60 or higher, maybe maybe 60 or higher.
Right.
It makes sense.
And we want to know if that's the case.
So we know that at this point, the grade is definitely less than 80, but now it can be in the range
between 60 to 80 or less than 60.
That's exactly what we want to find out.
And we want two different messages to different messages I'm sorry, printed for these two options.
So if the result of this condition is true, then we know that the grade is between 60 to 80.
And although that's not the best grade year that you can get on your exam.
That's not so bad.
Right.
So in this case, we would like to print not bad message.
And you've done you've done pretty well.
Not bad.
And otherwise, if the result of this condition happens also to be false, then we can definitely say
that the grade is less than 80.
And also it's less than 60.
So we will have to print a failed try again message and ask the user to give to give that another shot,
to give another shot at the exam.
So hopefully he will pass next time.
And that would basically be it, guys.
And that's how you use nested conditions in programming.
And you can embed them at any stage you like as many times as you like.
Just make sure that these whole structure makes sense.
All right.
And now, once we've mapped every sentence to these representation on the left, this graphical representation
on the left.
I want us to take a deeper look and see how it can be done in our programming language.
So let's take a look.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.