...
/Part 3: Creating Functions for an Automatic Light Application
Part 3: Creating Functions for an Automatic Light Application
Learn about the possible ways of returning values from a function.
We'll cover the following...
Returning values from a function
We have previously created a function, but now we must check whether this function needs to return something. It calculates the distance, which we need to be outside of the function—so that value needs to be returned.
Again, we have two options. We can either return the value contained inside the variable distance like this:
Access this course and 1400+ top-rated courses and projects.