Building your own reusable code with functions
Overview
Teaching: 30 min
Exercises: 50 minQuestions
How do we create reusable codes in our program?
What are some best practices in writing reusable codes?
Objectives
Learn how to write your own function using best practices.
Differentiate between named and unnamed functions.
Understand the difference between local and global variables.
Create your first well-documented function.
Key Points
Functions are the building block of programs.
Functions should be small and have minimal (or better, no) side effects.
Variables defined in a function are local and cannot be accessed outside of it.