Functions and Procedures Flashcards
(7 cards)
1
Q
Procedure definition
A
Block of code that is designed to perform a specific task. Procedures do not have to return a value
2
Q
Function definition
A
Block of code that is designed to perform a specific task that has to return a value
3
Q
How many values can a procedure return?
A
Multiple
4
Q
How many values can a function return?
A
It must return 1 and only 1 value
5
Q
How can parameters be passed into a subroutine?
A
By value or by reference
6
Q
What happens when a parameter is passed by value?
A
Its treated as a local variable, the original is unnaffected
7
Q
What happens when a parameter is passed by reference?
A
the address of the parameter is given so the original will be updated