Unit 7 Flashcards
how many values can a function return at a time
functions can only return one value at a time
a function can have
- parameters & return values in any capacity
parameter
a variable in a function definition
- used as a placeholder for values that will be passed through the function
argument
the vlaue passed to the parameter
return
- used to return the flow of control to the point where the procedure was called and to return the value of expression
procedural abstraction
extracting shared features to generalize functionality
how do you generalize functions
using parameters
benefits of procedural abstraction
- improves code readability
- allows for code reuse
library
a collection of functions that can be used in many different programs
a library should have documentation for the included functions:
- how each function works
- a complete list of the parameters
- what (if anything) will be returned
APIs (application program interface)
specifications for how the functions in a library behave and can be used
procedural abstraction allows functions to be used without
knowing their inner workings enabling modularity, which organizes programs into separate subprograms, like libraries do
to use a library
call the function by writing the library name, a dot, the name of the function, and including any arguments for the parameters