What does return value mean?
The value a function sends back to the code that called it, with the return statement. A function with no return statement sends back None.
In a lesson
A subprogram that returns a value, like
areaordistance(), is a function. One that only does something, likesquareorled("red"), is a procedure. Python usesdeffor both; the exam languages write them differently.
Learn it
- Taught in F4.2 Parameters and return values Functions and structured code, GCSE
Used in
- F1.3 Calling functions
- F4.1 Writing functions
- F4.3 Local and global variables
- F8.5 Negative numbers: two's complement
- F11.8 Writing secure programs
- A1.4 Subroutines, parameters and passing by reference
- A1.5 Scope, lifetime and debugging in an IDE
- A1.6 Programming paradigms and procedural programming
- A2.1 Stack frames and the call stack
- A2.2 Recursion
and 4 more lessons.
Do the lesson in the simulator