Conclusion
In this lesson, you learned about the following topics:
- How to check conditions with
if
and optionalelse if
andelse
statements. - Variable’s scope and shadowing.
Remember the order of the conditions in if
and else if
statements matters. The first matching
condition wins. If your program is taking some input from the user, you should
ideally handle the case when the input is invalid. Use the else
statement for that.
I hope you enjoyed this lesson. See you in the next one!