Subroutines, local and global variables Flashcards
What is a subroutine/procedure?
A named block of code designed to carry out a specific task
What is a local variable?
A variable that is available only in specified subroutines
What is a global variable?
A variable that is available anywhere in the program
What is a module?
A number of subroutines that form part of a program
What is a function?
A subroutine that returns a value
What is functional programming?
A programming paradigm that uses functions to create programs
What is an argument?
A value passed to a subroutine
What is a parameter?
The receiving variable of an argument in a subroutine
Give three advantages of using local variables over global variables
- The value cannot inadvertently be changed somewhere else in the program
- The same variable name can be used multiple times in different sections
- Each time a local variable is finished with, it gets removed from memory
What is exception handling?
The process of dealing with events that cause the current subroutine to stop