Functions and Procedures Flashcards
(4 cards)
What is a procedure?
A sequence of steps that performs a task but does not return a value to the caller
Identified by a name and called to execute a specific sub-task.
What is a function?
Similar to a procedure but designed to return a value to the caller after executing its sub-task
Functions are essential for operations requiring output.
What does it mean to pass parameters by value?
The actual value of a variable is passed to the function or procedure, and a copy is made
The original variable remains unchanged.
What does it mean to pass parameters by reference?
The address (reference) of the variable is passed, allowing the function or procedure to modify the original variable
This enables direct manipulation of the variable’s value.