The tutorial then shows us how to use the return statement to output values from our function. We learn that the return statement can be used with any data type and that we can even return objects and arrays from our functions.
The tutorial emphasizes that return statements are critical to our ability to write reusable functions. By allowing us to return specific values from our functions, we can use the output of one function as the input of another, creating a chain of functions that work together to solve a larger problem.
The tutorial also provides examples of how to use return statements in real-world scenarios. For example, it demonstrates how to write a function that calculates the average of an array of numbers using the return statement.
Finally, the tutorial covers some best practices for using return statements. For instance, it advises us to avoid having multiple return statements in a single function, as this can make our code harder to read and debug.