in reply to Re: No braces
in thread No braces
A common usage is when you don't want the if statement to obscure the readability of the code:
print "DEBUG: foo is $x\n" if $config->{debug};
is less distracting than:
if ($config->{debug}) { print "foo is $x\n"; }
The above statement reads more like English. Also, you can have main-path code not be obscured by error-handling logic, similarly enhancing readability, but this time in the reverse kind of way:
reticulate_splines() unless llamas_roaming_in_strawberries()
In the above example, we usually reticulate the splines (say 90% of the time), but in emergencies, we skip the statement.
If all languages read exactly like C, it would be boring.
|
|---|