What are reference variables?

So far, we have seen functions returning a single value only. However, there might be times when we want a function to return more than one value.

For example, say we want our function to find the maximum and the second maximum values and then return both values. However, the function can’t return two variables simultaneously.

There are some programming languages that support multi-value returns. For instance, programming languages like Python and Go allow us to return multiple values from a function simultaneously.

Look at the code below.

Get hands-on with 1200+ tech skills courses.