Parameters, Arguments and Abstraction
Parameters are input variables of a procedure. Arguments specify the values of the parameters when a procedure is called. The parameters are the names in…
Parameters and arguments
Parameters are input variables of a procedure. Arguments specify the values of the parameters when a procedure is called.The parameters are the names in the def line. The arguments are the values you put in the parentheses at the call.
In function calling, the actual arguments 2 and 4 are sent to the formal parameters a and b respectively. Position decides which goes where: the first argument fills the first parameter, the second fills the second.
Giving the wrong number of arguments
Abstraction
Abstraction means removing unnecessary detail. We can press the gas pedal to move a car forward without the need to understand the details of how an engine works.One common type of abstraction is procedural abstraction, which provides a name for a process, and allows a procedure to be used only knowing what it does, not how it does it.
The benefits of procedural abstraction
There are benefits to using procedural abstraction in our code. Procedural abstraction:• allows code to be readable
• provides an opportunity to give a name to a block of code that describes the purpose of the code block
• allows for code reuse, and reduces the amount of duplicated code