Subroutines Flashcards
What is a subroutine?
Subroutines are smaller, named sections of code that are written within a larger program
What are the advantages of sub routines?
Avoid duplicating code and can be reused throughout a program.
Improve the readability and maintainability of code.
Perform calculations, to retrieve data, or to make decisions based on input.
Why is it good practise to use local variables?
Using local variables rather than global variables makes it easier to debug a program as the value of that variable can only be read or changed within one subroutine.
What are the advantages of structured programming?
allows other programmers to easily follow the code that you have written.
less likely to contain logic errors.
Errors are more easily identified.