Perl Monk, Perl Meditation | |
PerlMonks |
Re: Smoothsortby Tux (Canon) |
on Sep 21, 2015 at 09:45 UTC ( [id://1142614]=note: print w/replies, xml ) | Need Help?? |
There shall be no else after return/die/croak. Ever!
SHould be rewritten to either
or using a ternary
with your personal preference to whitespace and indentation of course. The else in an if is there to give alternative code in a control flow where the code after the if/else contruct is executed for both branches. As the if branch ends with a return statement, immediatly exiting the routine, the code after if/else is never executed and only written for the else branch making the code harder to read and maintain. Enjoy, Have FUN! H.Merijn
In Section
Seekers of Perl Wisdom
|
|