in reply to Hidden Benefit of Perl Syntax
More than once I've seen people get tripped up when adding statements to conditional blocks without braces. I've done this myself, not claiming to be perfect or anything. For example, adding lines to code like:
if (condition) some_statement();
Resulting in the "obviously wrong if you know what you're looking for but surprisingly easy mistake to make" code:
if (condition) some_statement(); some_other_statement(); some_random_statement();
Added: I mean "obviously wrong" when the code change required is to add the "some_other_statement" and "some_random_statement" to the conditional. If you just look at the second code snippet without some other context, it's not clear whether it's just an indentation issue or an error due to lack of braces.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hidden Benefit of Perl Syntax
by Tux (Canon) on Jan 08, 2008 at 07:33 UTC | |
|
Re^2: Hidden Benefit of Perl Syntax
by tye (Sage) on Jan 08, 2008 at 00:30 UTC | |
by explorer (Chaplain) on Jan 08, 2008 at 11:12 UTC |