Subroutines (AQA GCSE Computer Science): Flashcards
📚Flashcards
Practise the cards
12 cards from this deck
ShowHide
Practise the cards
12 cards from this deck
Definition of subroutine
Definition of subroutine
Reusable code block defined once & used multiple times
Why break programs into subroutines
Why break programs into subroutines
Makes code easier to read, debug & maintain
First step when subroutine called
First step when subroutine called
Main program temporarily stops
Where control returns after subroutine
Where control returns after subroutine
Back to main program where it left off
Keywords to define subroutine
Keywords to define subroutine
SUBROUTINE and ENDSUBROUTINE
Definition of parameter
Definition of parameter
Value passed into subroutine
Why use parameters
Why use parameters
Makes subroutines flexible & reusable
Rule for calling with parameters
Rule for calling with parameters
Provide correct number & order of values
Code reusability benefit
Code reusability benefit
Write once, use many times
Easier maintenance benefit
Easier maintenance benefit
Update in one place, not entire program
How to call a subroutine
How to call a subroutine
Write its identifier (name) with parentheses
Organization benefit
Organization benefit
Breaks program into logical chunks
