Subroutines that Return Values (AQA GCSE Computer Science): Flashcards
📚Flashcards
Practise the cards
12 cards from this deck
ShowHide
Practise the cards
12 cards from this deck
Functions in programming
Functions in programming
Subroutines that calculate and return a value
Procedures in programming
Procedures in programming
Subroutines that carry out tasks without returning anything
Key difference: functions vs procedures
Key difference: functions vs procedures
Functions return a result, procedures just do something
RETURN keyword in pseudocode
RETURN keyword in pseudocode
Sends a value back to the main program from a function
Local variables
Local variables
Variables created inside a function
Local scope meaning
Local scope meaning
Variables only exist inside their specific function
Accessing local variables from main program
Accessing local variables from main program
Causes an error - local variables only exist inside function
Modularisation benefit of functions
Modularisation benefit of functions
Break large program into smaller, manageable chunks
Reusability benefit of functions
Reusability benefit of functions
Use function multiple times without rewriting code
Maintenance benefit of functions
Maintenance benefit of functions
Update code in one place only
Clear interfaces benefit of functions
Clear interfaces benefit of functions
Clear inputs (parameters) and outputs (return values)
Functions and structured programming
Functions and structured programming
Makes code organised, reusable, and easier to maintain
