Explain Empty Returns Like I'm Five

Christian Vasquez - Oct 12 '18 - - Dev Community

This kind of code can be confusing for beginners when they start coding:

function doSomething() {
    if (somethingElseHappens())
        return;

    // ...
}
Enter fullscreen mode Exit fullscreen mode

How would you explain this in a real life scenario that could tell how/why this is useful?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .