GoConqr has a new look! Let us know what you think.

Module 7 of 18 · Media

Nested if statements

Kostas Diakogiannis

Nested if statements

Nested if statements

 

What if i want to check further conditions inside conditions?

For example i want to check for a condition if the weather is bad. In case this is false i decide to go out with my t-shirt.

What if this is true? Then i need to check further if we are talking about rain (so i would take an umbrella, or if it snows , then i will go skiing!).

It is also possible to implement if statements that are lying inside other if statements. As the picture shows above, first i check if i have enough money to buy a single room to spend the night. If this is true, then and ONLY then i can explore further and check if i have 100$ more than the cheapest room. In such case, i can go possibly to a better hotel, or for example upgrade for a better room. If not, then probably i will take the cheapest room. 

All this upgrade plan will happen ONLY if i have enough money to take the cheapest room, then i can ask further to make myself more comfortable etc. But if i don't have the money even for that, then i will have to keep looking elsewhere. 

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?