3 ms·
Sorry, this is bad code. In the original version it's clear that there's only two possible outcomes: either you can drink, or you can't. Your version uses two
by yongjik 6y ago
Sorry, this is bad code. In the original version it's clear that there's only two possible outcomes: either you can drink, or you can't. Your version uses two different conditions, which makes four possibilities, which makes the code harder to reason because every reader must stop and think "Wait, can someone be underage and still allowed to drink? Or vice versa?"
Eliminate edge cases, especially those that should not arise in practice.