Thinking abstractly. Flashcards
What is recursion
A function that calls its self with a function
List 2 difference betwen global and local variables.
Global variables are visible throughout the program and can be accessed throughout the program. Whilst local variables are only visiable from within the module.
Why it is better practice not to use global variables?
Global variables make it difficult to integrate modules.
Why is it better to use parameters passes to the function rather than global variables?
Only a copy of the data is passed to the function. So no unforeseen changes will be made to the data.
Describe what is meant by a function?
A function is named section of a program that performs a specific task and returns a value oftern called inline.
What is a procedure?
A name section of a program that performs a specific task and does not return value, Most programming languages nowadays use functions.
What is a parameter?
A parameter is the name of the information we want to use in a function or procedure. The values passed in are called arguments and they are usally passed by value, so only a copy of the data is used within the function.
What is pass by reference
when a function points to the actual value in memory so if changes are made to the variable, they remain when the function ends.
What is pass by value?
When a function uses a copy of value so if changes are made only the local copy is amended.