Return values
Values that functions send back to calling code when they complete execution. Return statements specify which value to return and immediately exit the function. Functions may return single values, tuples, objects, or nothing at all. Return values enable functions to produce results that calling code can use.
Real World
When Google Maps calculates a route, the getRoute() function returns an object containing distance, duration, and step-by-step directions — the calling code then displays each piece in a different part of the UI.
Exam Focus
When writing pseudocode, always show the returned value being stored or used by the caller to demonstrate understanding.
How well did you know this?