Returning The Favor

Alright, we’ve seen early exit for loops. How about functions? To do that, we use the return keyword. Let’s see how we can use return to bypass extra indentation. Take this code, which politely doesn’t tell people 30 and older how old they are:

Get hands-on with 1000+ tech skills courses.