What I learned about parameters

     A function is a group of instructions or commands that serve to reduce the complexity of writing. Essentially, one outcome that needs many lines of code to achieve can be achieved with one line of code, the call to the function once it is defined. While reducing a lot of complexity even more complexity can be reduced through use of parameters. A parameter is additional information passed to a function to customize it. If a coder wrote a program to draw a triangle to draw a smaller triangle the coder would need to copy the entire function and change only the parts that controlled size within the function to make a smaller triangle. Instead of having multiple functions for different sizes, however, adding a parameter to specify size allows the coder to use 1 function to make many sizes of triangles. What the parameter did was make the function less specific and more customizable. It makes programs manageable since a coder doesn't need to worry about defining many functions with parameters reducing the amount of functions needed in a program. Thus, parameters are a form of abstraction since they simplify more complex code.

Comments

Popular posts from this blog

Favicons

Favorite Teacher Project Reflection

Lab 20 Reflection