subroutines Flashcards
1
Q
What are the two main types of subroutines?
A
Procedures and functions.
2
Q
What is the difference between procedures and functions?
A
Procedures do not return a value
functions do return a value
3
Q
What is a parameter?
A
It is a variable in a function which is used to refer to a piece of data provided as an input to the function.
4
Q
What is a local variable?
A
It is when a subroutine declares their own variable.
5
Q
What are two features of a local variable?
A
- They only exist while the subroutine is executing.
- They are only accessible within the subroutine.
6
Q
What is a return value?
A
It is a value which the function returns when it has completed a task.