Re:Your programming language is probably unproductive
by papaf on Wednesday September 28, 2016 @12:50PM
(#12599219)
One way round this is to put single statement ifs on a single line:
If you add another statement to the if, its obvious from the indent that you need to use braces.
[ Parent
| on HN ]
Re:Your programming language is probably unproductive
by petre on Wednesday September 28, 2016 @01:21PM
(#12599488)
Yup, I always do this when writing JavaScript or other languages that allow prefix single statements with or without braces. Otherwise I use braces if the statement is too long to fit in the editor w/o forcing you to scroll. Perl only allows postfixed single statements w/o braces, so you're safe:
say "yes" if $condition;
if ($condition) {
say "yes";
$affirmative++;
}