3 ms·
Those one line returns are particularly handy at the beginning of methods, to validate or process arguments and return immediately for simple cases.
by pmontra 4y ago
Those one line returns are particularly handy at the beginning of methods, to validate or process arguments and return immediately for simple cases.
- hnzix 4y agoShort circuiting is such a beautiful way of avoiding giant nested "if" mountains. I wish it was more widely used.
- ilyt 4y agoright but if condition { return } works well enough in other languages and shows actual condition (the important part) to programmer first. if that if and extra brackets is really too long Perl way is also option. condition || return