in reply to No braces
// YES // YES // NO if (cond) if (cond) { if (cond) { task(); task(); task(); else } else { } else alternate(); alternate(); alternate(); }
I love Perl's statement modifiers. I'm often going back to a C or C++ project and finding myself typing something like:
I also like using parens around first-class conditionals when required in Perl, but dropping them for modifiers which don't need them.double calc_stuff(double x) { return 0 if x < 0; ... }
if (condition) { task() } task() if condition;
--
[ e d @ h a l l e y . c c ]
|
|---|