Passing Parameters (AQA GCSE Computer Science): Flashcards
📚Flashcards
Practise the cards
12 cards from this deck
ShowHide
Practise the cards
12 cards from this deck
What is a subroutine?
What is a subroutine?
Named code block outside main program, callable multiple times
Main advantage of subroutines
Main advantage of subroutines
Code reusability - write once, call whenever needed
What 'calling' a subroutine means
What 'calling' a subroutine means
Running the subroutine
What are parameters?
What are parameters?
Values passed to subroutine to customize its behavior
Purpose of empty brackets () in subroutines
Purpose of empty brackets () in subroutines
Where parameters go when used
Effect of parameters on subroutine
Effect of parameters on subroutine
Customize what subroutine does each time called
Subroutine without parameters
Subroutine without parameters
Always does exactly the same thing
When calling with parameters, you provide
When calling with parameters, you provide
The actual values
Why parameter order matters
Why parameter order matters
1st value goes to 1st parameter, 2nd to 2nd, etc.
Flexibility benefit of parameters
Flexibility benefit of parameters
One subroutine handles many different situations
Code reduction benefit of parameters
Code reduction benefit of parameters
Write one subroutine instead of many versions
Maintenance benefit of parameters
Maintenance benefit of parameters
Update once in one place instead of multiple locations
