Subroutines Flashcards Preview

1 Computing AS Level (JoshH) > Subroutines > Flashcards

Flashcards in Subroutines Deck (4)
Loading flashcards...

Define subroutines

Subroutines are a way of managing and organising programs in a structured way. This allows us to break up programs into smaller chunks.


What is the difference between a procedure and a subroutine

Subroutines that do not return values and do not have to have input parameters are called procedures.
Subroutines that allow us to have both input and output are called functions.


What is a global variable?

A global variable is a variable that can be used anywhere in a program. The issue with global variables is that one part of the code may inadvertently modify the value because global variables are hard to track.


What is a local variable?

A local variable is a variable that can only be accessed within a certain block of code typically within a function. Local variables are simple not recognized outside a function unless they are returned. There is no way of modifying or changing the behavior of a local variable outside its scope.