Conclusion

In this lesson, you learned about the following topics:

  • How to check conditions with if and optional else if and else 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!

See forum comments
Download course materials from Github
Previous: Demo Next: Quiz: Branch Control Flow