Chapter 5: Functions — Making Code Modular and Maintainable
- A function is a callable block of code that provides modularity to a program, can accept parameters/arguments, and will only run when invoked.
- Arguments that are pre-assigned and do not need to be provided when the function is called.
- A parameter that is assigned a value when the function is called based on its name.
- The function’s parameters, return type, and other attributes that distinguish it.
- By default in a one-to-one fashion.
- Any amount of code as long as the code’s intended purpose can be described in one sentence without the word and.
- The type of value the function will return.
- Technically yes, depending on the system. However, certain return types cannot be assigned to certain variables.